Re: Nginx as a proxy...
On 20.05.2015 09:46, Mark Thomas wrote: On 20/05/2015 07:56, Bjørn T Johansen wrote: On 20.05.2015 08:27, Mark Thomas wrote: On 19/05/2015 22:25, Bjørn T Johansen wrote: I have a small problem using nginx as a reverse proxy in front of Tomcat 8.. The problem is that sometimes the context url is set to the local ip address of the tomcat server instead of the hostname used to access the nginx server. And I know this can be solved by using proxyname and proxypost but as far as I can see, this can only be configured for the connector port, which make the setting global? Add I run 5 other web applications in the same Tomcat instance so changing this globally is not an option... Anyway to solve this? option 1. Configure nginx to set the host header as you wish option 2. Remote IP Host/Valve (still requires nginx config) Mark Thx, was missing the HOST header... And now the url is almost correct... The remaining problem, is that the url looses the scheme used, so it gets redirected to http address instead of https; is that configured in the Tomcat config somewhere or? Set the scheme on the connector. If nginx is receiving both http and https traffic then the simplest way is to have two connectors in Tomcat, one with scheme="http" and one with scheme="https" (and secure="true"). Note that scheme, secure and sslEnabled may all be set independently to handle the various permutations of reverse proxy config. Mark Yes, just thought of having a second connector for ssl, thx for confirming it... :) BTJ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Nginx as a proxy...
On 20/05/2015 07:56, Bjørn T Johansen wrote: > On 20.05.2015 08:27, Mark Thomas wrote: >> On 19/05/2015 22:25, Bjørn T Johansen wrote: >>> I have a small problem using nginx as a reverse proxy in front of >>> Tomcat 8.. The problem is that sometimes the context url is set to >>> the local ip >>> address of the tomcat server instead of the hostname used to access >>> the nginx server. >>> And I know this can be solved by using proxyname and proxypost but as >>> far as I can see, this can only be configured for the connector port, >>> which >>> make the setting global? Add I run 5 other web applications in the >>> same Tomcat instance so changing this globally is not an option... >>> >>> Anyway to solve this? >> >> option 1. Configure nginx to set the host header as you wish >> >> option 2. Remote IP Host/Valve (still requires nginx config) >> >> Mark >> > > Thx, was missing the HOST header... And now the url is almost correct... > The remaining problem, is that the url looses the scheme used, so it > gets redirected to http address instead of https; is that configured in > the Tomcat config somewhere or? Set the scheme on the connector. If nginx is receiving both http and https traffic then the simplest way is to have two connectors in Tomcat, one with scheme="http" and one with scheme="https" (and secure="true"). Note that scheme, secure and sslEnabled may all be set independently to handle the various permutations of reverse proxy config. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Nginx as a proxy...
On 20.05.2015 08:27, Mark Thomas wrote: On 19/05/2015 22:25, Bjørn T Johansen wrote: I have a small problem using nginx as a reverse proxy in front of Tomcat 8.. The problem is that sometimes the context url is set to the local ip address of the tomcat server instead of the hostname used to access the nginx server. And I know this can be solved by using proxyname and proxypost but as far as I can see, this can only be configured for the connector port, which make the setting global? Add I run 5 other web applications in the same Tomcat instance so changing this globally is not an option... Anyway to solve this? option 1. Configure nginx to set the host header as you wish option 2. Remote IP Host/Valve (still requires nginx config) Mark Thx, was missing the HOST header... And now the url is almost correct... The remaining problem, is that the url looses the scheme used, so it gets redirected to http address instead of https; is that configured in the Tomcat config somewhere or? BTJ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Nginx as a proxy...
On 19/05/2015 22:25, Bjørn T Johansen wrote: > I have a small problem using nginx as a reverse proxy in front of Tomcat 8.. > The problem is that sometimes the context url is set to the local ip > address of the tomcat server instead of the hostname used to access the nginx > server. > And I know this can be solved by using proxyname and proxypost but as far as > I can see, this can only be configured for the connector port, which > make the setting global? Add I run 5 other web applications in the same > Tomcat instance so changing this globally is not an option... > > Anyway to solve this? option 1. Configure nginx to set the host header as you wish option 2. Remote IP Host/Valve (still requires nginx config) Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Nginx as a proxy...
I have a small problem using nginx as a reverse proxy in front of Tomcat 8.. The problem is that sometimes the context url is set to the local ip address of the tomcat server instead of the hostname used to access the nginx server. And I know this can be solved by using proxyname and proxypost but as far as I can see, this can only be configured for the connector port, which make the setting global? Add I run 5 other web applications in the same Tomcat instance so changing this globally is not an option... Anyway to solve this? Regards, BTJ -- --- Bjørn T Johansen b...@havleik.no --- Someone wrote: "I understand that if you play a Windows CD backwards you hear strange Satanic messages" To which someone replied: "It's even worse than that; play it forwards and it installs Windows" --- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org