Commit 550b1170 authored by Matt Holt's avatar Matt Holt Committed by GitHub

Merge branch 'master' into 1173

parents d0455c7b d44016b9
......@@ -824,6 +824,11 @@ func TestProxyDirectorURL(t *testing.T) {
expectURL: `https://localhost:2021/t?foo%3dbar&t%3dw`,
without: "/test",
},
{
requestURL: `http://localhost:2020/test/`,
targetURL: `https://localhost:2021/t/`,
expectURL: `https://localhost:2021/t/test/`,
},
} {
targetURL, err := url.Parse(c.targetURL)
if err != nil {
......
......@@ -98,7 +98,13 @@ func NewSingleHostReverseProxy(target *url.URL, without string, keepalive int) *
}
}
hadTrailingSlash := strings.HasSuffix(req.URL.Path, "/")
req.URL.Path = path.Join(target.Path, req.URL.Path)
// path.Join will strip off the last /, so put it back if it was there.
if hadTrailingSlash && !strings.HasSuffix(req.URL.Path, "/") {
req.URL.Path = req.URL.Path + "/"
}
// Trims the path of the socket from the URL path.
// This is done because req.URL passed to your proxied service
// will have the full path of the socket file prefixed to it.
......
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