Skip to content

Commit

Permalink
Merge pull request #55 from Remitly/preserve-host-config
Browse files Browse the repository at this point in the history
sso-proxy: add preserve host configuration option
  • Loading branch information
jphines authored Dec 1, 2018
2 parents c0ce81d + 9f81a78 commit 6a6f920
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 145 deletions.
8 changes: 6 additions & 2 deletions internal/proxy/oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ func NewReverseProxy(to *url.URL, config *UpstreamConfig) *httputil.ReverseProxy
proxy.Director = func(req *http.Request) {
req.Header.Add("X-Forwarded-Host", req.Host)
director(req)
req.Host = to.Host
if !config.PreserveHost {
req.Host = to.Host
}
}
return proxy
}
Expand Down Expand Up @@ -214,7 +216,9 @@ func NewRewriteReverseProxy(route *RewriteRoute, config *UpstreamConfig) *httput

req.Header.Add("X-Forwarded-Host", req.Host)
director(req)
req.Host = target.Host
if !config.PreserveHost {
req.Host = target.Host
}
}
return proxy
}
Expand Down
Loading

0 comments on commit 6a6f920

Please sign in to comment.