Commit 2536ea74 authored by Matt Holt's avatar Matt Holt

Merge pull request #859 from jupiter/fix/issue-643

Fix for cleaned URL.Path
parents a0e6eb3b 9acfec54
...@@ -165,6 +165,11 @@ func createUpstreamRequest(r *http.Request) *http.Request { ...@@ -165,6 +165,11 @@ func createUpstreamRequest(r *http.Request) *http.Request {
outreq := new(http.Request) outreq := new(http.Request)
*outreq = *r // includes shallow copies of maps, but okay *outreq = *r // includes shallow copies of maps, but okay
// Restore URL Path if it has been modified
if outreq.URL.RawPath != "" {
outreq.URL.Opaque = outreq.URL.RawPath
}
// Remove hop-by-hop headers to the backend. Especially // Remove hop-by-hop headers to the backend. Especially
// important is "Connection" because we want a persistent // important is "Connection" because we want a persistent
// connection, regardless of what the client sent to us. This // connection, regardless of what the client sent to us. This
......
...@@ -309,6 +309,8 @@ func TestUnixSocketProxyPaths(t *testing.T) { ...@@ -309,6 +309,8 @@ func TestUnixSocketProxyPaths(t *testing.T) {
{"/proxy/hello", "/proxy", fmt.Sprintf(greeting, "/hello")}, {"/proxy/hello", "/proxy", fmt.Sprintf(greeting, "/hello")},
{"/proxy/foo/bar", "/proxy", fmt.Sprintf(greeting, "/foo/bar")}, {"/proxy/foo/bar", "/proxy", fmt.Sprintf(greeting, "/foo/bar")},
{"/proxy/?foo=bar", "/proxy", fmt.Sprintf(greeting, "/?foo=bar")}, {"/proxy/?foo=bar", "/proxy", fmt.Sprintf(greeting, "/?foo=bar")},
{"/queues/%2F/fetchtasks", "", fmt.Sprintf(greeting, "/queues/%2F/fetchtasks")},
{"/queues/%2F/fetchtasks?foo=bar", "", fmt.Sprintf(greeting, "/queues/%2F/fetchtasks?foo=bar")},
} }
for _, test := range tests { for _, test := range tests {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment