Skip to content
Snippets Groups Projects
Commit 13dde5eb authored by PJ Eby's avatar PJ Eby Committed by Rohith Jayawardene
Browse files

Allow setting upstream Host header (#290)

parent 297e1db2
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,12 @@ func (r *oauthProxy) proxyMiddleware(next http.Handler) http.Handler {
// and we must update the host headers
req.URL.Host = r.endpoint.Host
req.URL.Scheme = r.endpoint.Scheme
if v := req.Header.Get("Host"); v != "" {
req.Host = v
req.Header.Del("Host")
} else {
req.Host = r.endpoint.Host
}
req.Header.Add("X-Forwarded-For", realIP(req))
req.Header.Set("X-Forwarded-Host", req.URL.Host)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment