[GH-ISSUE #343] 请求头里没有path的问题 #261

Closed
opened 2026-02-27 23:16:13 +03:00 by kerem · 2 comments
Owner

Originally created by @lixiaomeng8520 on GitHub (Dec 23, 2019).
Original GitHub issue: https://github.com/snail007/goproxy/issues/343

一些客户端,比如java的URL请求或者早期的curl请求时,header里不会自动在最后加上斜杠,比如
curl http://www.baidu.com,打印出的header为
GET http://www.baidu.com HTTP/1.1
这时如果通过goproxy代理,则请求头会变为
GET HTTP/1.1
path信息为空,服务端会返回 400。

解决办法有2个,

  1. 在客户端自动添加斜杠。
  2. 代理处自动添加斜杠(nginx代理时,会自动加上)。

希望作者能处理第二种。

Originally created by @lixiaomeng8520 on GitHub (Dec 23, 2019). Original GitHub issue: https://github.com/snail007/goproxy/issues/343 一些客户端,比如java的URL请求或者早期的curl请求时,header里不会自动在最后加上斜杠,比如 `curl http://www.baidu.com`,打印出的header为 `GET http://www.baidu.com HTTP/1.1`, 这时如果通过goproxy代理,则请求头会变为 `GET HTTP/1.1`, path信息为空,服务端会返回 400。 解决办法有2个, 1. 在客户端自动添加斜杠。 2. 代理处自动添加斜杠(nginx代理时,会自动加上)。 希望作者能处理第二种。
kerem closed this issue 2026-02-27 23:16:13 +03:00
Author
Owner

@snail007 commented on GitHub (Dec 23, 2019):

多谢反馈,v8.8已经做了兼容处理,这种情况会自动加上/

<!-- gh-comment-id:568398743 --> @snail007 commented on GitHub (Dec 23, 2019): 多谢反馈,v8.8已经做了兼容处理,这种情况会自动加上/
Author
Owner

@lixiaomeng8520 commented on GitHub (Jan 6, 2020):

@snail007 OK

<!-- gh-comment-id:571044448 --> @lixiaomeng8520 commented on GitHub (Jan 6, 2020): @snail007 OK
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/goproxy#261
No description provided.