Commit 4dbd58a2 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'fix/forward_host_header' into 'master'

Forward Host header to the auth backend

The Host header is handled specially by the Go http library and
needs special processing in order to have it forwarded with the
other headers to the auth backend.

This allows the Host header received by the backend to be consistent with other 
requests not going through gitlab-git-http-server.


See merge request !5
parents 3455940b af4df076
......@@ -149,6 +149,10 @@ func (h *gitHandler) doAuthRequest(r *http.Request) (result *http.Response, err
for k, v := range r.Header {
authReq.Header[k] = v
}
// Also forward the Host header, which is excluded from the Header map by the http libary.
// This allows the Host header received by the backend to be consistent with other
// requests not going through gitlab-git-http-server.
authReq.Host = r.Host
// Set custom user agent for the request. This can be used in some
// configurations (Passenger) to solve auth request routing problems.
authReq.Header.Set("User-Agent", "gitlab-git-http-server")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment