diff --git a/caddyhttp/proxy/proxy_test.go b/caddyhttp/proxy/proxy_test.go index 9ccda845..6ba05000 100644 --- a/caddyhttp/proxy/proxy_test.go +++ b/caddyhttp/proxy/proxy_test.go @@ -26,7 +26,6 @@ import ( "github.com/mholt/caddy/caddyfile" "github.com/mholt/caddy/caddyhttp/httpserver" - "github.com/mholt/caddy/caddyhttp/staticfiles" "golang.org/x/net/websocket" ) @@ -995,8 +994,6 @@ func TestProxyDirectorURL(t *testing.T) { t.Errorf("case %d failed to create request: %s", i, err) continue } - req = req.WithContext(context.WithValue(req.Context(), - staticfiles.URLPathCtxKey, c.originalPath)) NewSingleHostReverseProxy(targetURL, c.without, 0).Director(req) if expect, got := c.expectURL, req.URL.String(); expect != got { diff --git a/caddyhttp/proxy/reverseproxy.go b/caddyhttp/proxy/reverseproxy.go index 56d3de47..056a1942 100644 --- a/caddyhttp/proxy/reverseproxy.go +++ b/caddyhttp/proxy/reverseproxy.go @@ -159,12 +159,7 @@ func NewSingleHostReverseProxy(target *url.URL, without string, keepalive int) * prefer(target.RawPath, target.Path), prefer(req.URL.RawPath, req.URL.Path)) } - req.URL.Path = singleJoiningSlash(target.Path, - prefer(untouchedPath, req.URL.Path)) - // req.URL.Path must be consistent with decoded form of req.URL.RawPath if any - if req.URL.RawPath != "" && req.URL.RawPath != req.URL.EscapedPath() { - panic("RawPath doesn't match Path") - } + req.URL.Path = singleJoiningSlash(target.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