Issue 914: Wrong redirect from Mail-Links when using canonicalWebUrl
Status:  Invalid
Owner: ----
Closed:  May 2011
Reported by paroga@paroga.com, Apr 20, 2011
Affected Version: 2.1.6.1

What steps will reproduce the problem?
1. Set gerrit.canonicalWebUrl = http://reviewserver/gerrit/
2. gerrit sends out correct mails with http://reviewserver/gerrit/1234
3. When opening http://reviewserver/gerrit/1234 gerrit redirects to http://reviewserver/#q,1,n,z instead of http://reviewserver/gerrit/#q,1,n,z

May 20, 2011
Project Member #1 nas...@grainawi.org
Are you running a web server in front of Gerrit or just using the embedded Jetty server?
Status: AwaitingInformation
May 21, 2011
#2 paroga@paroga.com
apache proxy connects to the embedded jetty server
May 22, 2011
Project Member #4 nas...@grainawi.org
I would double check your apache configuration. I've seen this happen when I had mine set up just a little incorrectly.
https://review.source.android.com/Documentation/config-reverseproxy.html
May 22, 2011
#5 paroga@paroga.com
FYI: I bind gerrit only to 127.0.0.1:8020, so apache can handle the authentication.

I tried different ways but no one worked in all cases.

The documentation does not mention any ProxyPassReverse configuration, but without I'm not able to get it running.

If I configure apache, so that "http://reviewserver/gerrit/123 redirects to "http://reviewserver/gerrit/#q,123,n,z then (when _not_ logged in) "http://reviewserver/gerrit/ redirects to "http://reviewserver/gerrit/gerrit/#mine

If I configure apache, so that "http://reviewserver/gerrit/ redirects to "http://reviewserver/gerrit/#mine then "http://reviewserver/gerrit/123 redirects to "http://reviewserver/#q,123,n,z

What's the correct behaviour? What should the Location-header look like? Are there any examples how to configure apache? I also want to be able to access the server via it's IP directly and want to get redirected to "http://123.45.67.89/gerrit/
May 23, 2011
#6 paroga@paroga.com
I use "listenUrl = http://127.0.0.1:8020/ because with "proxy-http://127.0.0.1:8020/gerrit/ gerrit isn't able to use user from apache AuthType Basic.
Maybe that's the basic problem.

May 23, 2011
#7 sop@google.com
The right configuration is:

  Apache:
    ProxyPass /gerrit/ http://reviewserver:8080/gerrit/

  gerrit:
    [gerrit]
      canonicalWebUrl = http://reviewserver/gerrit/
    [httpd]
      listenUrl = proxy-http://reviewservier:8080/gerrit/

Anything else and yes, the server will misbehave.
Status: Invalid
May 23, 2011
#8 paroga@paroga.com
I tried this configuration, but as mentioned in comment #6, I'm not able to log in with that configuration. I get a "Session inavalid" popup all the time.