evanchueng / gerrit

Automatically exported from code.google.com/p/gerrit
Apache License 2.0
0 stars 0 forks source link

Welcome email contains intermal server IP address. #628

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version: 2.1.3

What steps will reproduce the problem?
1. Setup Gerrit to use HTTP
2. setup APACHE to redirect from https://foo.com/gerrit/ to -> 
http://internal:8080/gerrit/ using ProxyPass and ProxyPassReverse
3. Login and Register an email address

What is the expected output? What do you see instead?
Expect the welcome email to contain links to the gerrit installation @ 
https://foo.com/gerrit/.  

Email reads:

Welcome to Gerrit Code Review at internal-ip.

To add a verified email address to your user account, please click on the 
following link:

http://internal-ip:port/#VE,mericZaqLCOPbejjMUUHgqRj1oZHPZfWd2x+Rs1A==$ZW1tYW51Z
WwuaWhlbmFjaG9AYWNjZW50dXJlLmNvbQ==

If you have received this mail in error, you do not need to take any action to 
cancel the account. The account will not be activated, and you will not receive 
any further emails.

If clicking the link above does not work, copy and paste the URL in a new 
browser window instead.

This is a send-only email address.  Replies to this message will not be read or 
answered.

Please provide any additional information below.

Is there like a self variable that can be set?

Original issue reported on code.google.com by eihena...@googlemail.com on 19 Jul 2010 at 8:30

GoogleCodeExporter commented 9 years ago
You probably need to change the httpd.listenUrl parameter
to be proxy-http:// rather than http://.  This will modify
how the server reads the HTTP request to pay attention to
the proxy headers inserted by Apache, allowing it to use
the URL Apache is serving.

You can also set the gerrit.canonicalWebUrl parameter
to be the URL you want Gerrit accessed as.  Setting this
will help to ensure that Gerrit always knows its address,
even if its not currently handling a web request.

Both variables are in site_path/etc/gerrit.config.

Original comment by sop@google.com on 19 Jul 2010 at 1:59

GoogleCodeExporter commented 9 years ago
Hi,
Hi,

Thanks,

That almost worked.  I think you are right in that it is related to one of 
those parameters.  

http.listenrUrl now point to proxt-http and this now resolves correctly.. 
However there is another problem.  My APACHE server ProxyPass rules are 
something like:

ProxyPass /gerrit/ http://internal-ip:8080/
ProxyPassReverse /gerrit/ http://internal-ip:8080/

However the link that is created is omitting the gerrit/

e.g:
https://externalservername.com/#VE,q4FLRKTBuympzCOiQuoq04J/t1v3srz26DDxvQ==$ZW1t
YW51ZWwuaWhlbmFjaG9AYWNjZW50dXJlLmNvbQ== 

Could those rules cause this problem?  

Regards,

EI

Original comment by eihena...@googlemail.com on 19 Jul 2010 at 8:26

GoogleCodeExporter commented 9 years ago
Yes.  If your Apache server has /gerrit/ as the URL
then you actually need to do:

  ProxyPass /gerrit/ http://internal-ip:8080/gerrit/

and setup the same thing in listenUrl:

  [http]
    listenUrl = proxy-http://internal-ip:8080/gerrit/

Original comment by sop@google.com on 19 Jul 2010 at 9:00

GoogleCodeExporter commented 9 years ago
|The question is how do I get gerrit to server from here?  
http://internal-ip:8080/gerrit/ Jetty config or Apache?  Can I do that with 
just starting the gerrit.sh at command line?

Original comment by eihena...@googlemail.com on 19 Jul 2010 at 10:24

GoogleCodeExporter commented 9 years ago
The path portion of the URL in the apache
configuration must match the path portion
of the URL in gerrit.config's own http
listenUrl variable.

So if Apache has /gerrit/, you need to also
put that into the URL in gerrit.config.

Original comment by sop@google.com on 19 Jul 2010 at 10:48

GoogleCodeExporter commented 9 years ago
I overlooked that.  Thanks mate.. SOLVED

Original comment by eihena...@googlemail.com on 20 Jul 2010 at 12:09