mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-19 08:51:55 +08:00
添加原始请求的查询参数到目标URL,以确保代理请求能够正确传递查询信息。
This commit is contained in:
parent
0335640df5
commit
d1db2835b4
@ -247,6 +247,11 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
encodedPath := strings.Join(parts, "/")
|
encodedPath := strings.Join(parts, "/")
|
||||||
targetURL := targetBase + encodedPath
|
targetURL := targetBase + encodedPath
|
||||||
|
|
||||||
|
// 添加原始请求的查询参数
|
||||||
|
if r.URL.RawQuery != "" {
|
||||||
|
targetURL = targetURL + "?" + r.URL.RawQuery
|
||||||
|
}
|
||||||
|
|
||||||
// 解析目标 URL 以获取 host
|
// 解析目标 URL 以获取 host
|
||||||
parsedURL, err := url.Parse(targetURL)
|
parsedURL, err := url.Parse(targetURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user