Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Allow setting upstream Host header #290

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
req.Host = r.endpoint.Host
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)
Expand Down