summaryrefslogtreecommitdiff
path: root/workhorse/internal/proxy
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-06 15:08:23 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-06 15:08:23 +0000
commit5472bef68de87deeb67594a98e7eb35ff83929ec (patch)
tree66e0267a3727f69ec8550d2e9b64152687d717b5 /workhorse/internal/proxy
parent39c98649d20e08428f507e0728b0bd87a299e5cf (diff)
downloadgitlab-ce-5472bef68de87deeb67594a98e7eb35ff83929ec.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/proxy')
-rw-r--r--workhorse/internal/proxy/proxy.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/workhorse/internal/proxy/proxy.go b/workhorse/internal/proxy/proxy.go
index cd8376285e1..06e2c65a6a8 100644
--- a/workhorse/internal/proxy/proxy.go
+++ b/workhorse/internal/proxy/proxy.go
@@ -57,6 +57,14 @@ func NewProxy(myURL *url.URL, version string, roundTripper http.RoundTripper, op
previousDirector := p.reverseProxy.Director
p.reverseProxy.Director = func(request *http.Request) {
previousDirector(request)
+
+ // send original host along for the upstream
+ // to know it's being proxied under a different Host
+ // (for redirects and other stuff that depends on this)
+ request.Header.Set("X-Forwarded-Host", request.Host)
+ request.Header.Set("Forwarded", fmt.Sprintf("host=%s", request.Host))
+
+ // override the Host with the target
request.Host = request.URL.Host
}
}