Commit f8614b87 authored by Matthew Holt's avatar Matthew Holt

Revert 344017dc (#1584)

parent 182e1b4f
......@@ -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 {
......
......@@ -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
......
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