After installing Gerrit following Using Gerrit in production
section from https://github.com/GerritCodeReview/docker-gerrit, the field was set automatically to this value:
[gerrit]
canonicalWebUrl = http://eac32ee72f2b/
I want to use Gerrit behind a reverse proxy, so I configured Apache2 like this:
ProxyPass / http://192.168.19.241:8080/ nocanon
This works, but as soon as I set gerrit.canonicalWebUrl
to https://gerrit.example.com
, I get The page isn’t redirecting properly and the URL in the browser becomes https://gerrit.example.com//login/
.
If I try to set the cannonical web url to https://gerrit.example.com/g/
and update Apache2 accordingly to:
ProxyPass /g/ http://192.168.19.241:8080/g/ nocanon
I get "Not found" message in the browser and the URL in the bar now reads https://gerrit.example.com/g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g//g
. If I inspect the HTTP headers, for the initial request for page https://gerrit.example.com/g
I get a 301 redirect to https://gerrit.example.com/g//g
.
In all cases, the configuration httpd.listenUrl
was proxy-http://*:8080
.
Can anyone tell me what am I doing wrong? I would like to set the proper web URL, because it is visible in the links to checkout repositories over HTTP, and maybe also in other places.
I missed this chapter: https://gerrit-review.googlesource.com/Documentation/config-reverseproxy.html#_ssl
It is written to use
proxy-https
instead ofproxy-http
when using HTTPS with Apache2. It all worked with this configuration: