Skip to content

Commit 30dfe26

Browse files
committed
fix re-host=1 option for http: handler
1 parent 899be16 commit 30dfe26

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

http_handler.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func NewHttpHandler(urlPath, params string, cfg *serverConfig) http.Handler {
4848
defaultDirector := prxHandler.Director
4949
prxHandler.Director = func(request *http.Request) {
5050
origPath := request.URL.Path
51-
origHost := request.URL.Host
5251
origRequest := request.Clone(request.Context())
5352
defaultDirector(request)
5453
if pathRe != nil {
@@ -59,7 +58,7 @@ func NewHttpHandler(urlPath, params string, cfg *serverConfig) http.Handler {
5958
}
6059
orig := origPath
6160
if pathReWithHost {
62-
orig = origHost + orig
61+
orig = origRequest.Host + orig
6362
}
6463
matches := pathRe.FindAllStringSubmatchIndex(orig, -1)
6564
if matches == nil {

0 commit comments

Comments
 (0)