Commit 8708f1dc authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'send-user-agent' into 'master'

Add custom "User-Agent" header to auth requests

This makes it a lot easier to proxy requests to gitlab-git-http-server when Gitlab is running inside Passenger (or similiar) and therefore does not have a dedicated port.

Example Apache config:
~~~~
RewriteEngine on
RewriteCond "%{REQUEST_URI}" "^[-/\w\.]+\.git/"
RewriteCond "%{HTTP_USER_AGENT}" "!=gitlab-git-http-server"
RewriteRule . http://127.0.0.1:8181%{REQUEST_URI} [P,QSA]
~~~~

See merge request !1
parents c846662d 32657fca
......@@ -140,6 +140,9 @@ func (h *gitHandler) doAuthRequest(r *http.Request) (result *http.Response, err
for k, v := range r.Header {
authReq.Header[k] = v
}
// 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")
return h.httpClient.Do(authReq)
}
......
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