You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jan Fröhlich <Ja...@infomotion.de> on 2010/06/16 17:47:35 UTC

[s2] Strange behaviour of s2 application behind reverse proxy

Hi all,

 

after (nearly) finishing a struts2 project with struts 2.1.8.1 we have an odd issue testing the application behind an apache reverse proxy server.

 

In web.xml is "index.jsp" as welcome page defined. Index.jsp contains just a <% response.sendRedirect("home.action") %> (please don't ask if its necessary).

Home.action is secured by an LoginInterceptor that checks for a valid session in some backend system and redirects to login.action if the session is invalid.

After a successful login through a login form, the home.action is called.

 

In our test environment everything works fine with http. When we test it with https behind an apache reverse proxy every redirect described above leads to a switch in the protocol from https to http. Once the home.action is loaded, and the following calls are made with jQuery, everything works fine.

 

There is no absolute link in the application, we are always using relative paths.

 

Any help appreciated!!

 

Regards,

Jan


Re: [s2] Strange behaviour of s2 application behind reverse proxy

Posted by Gabriel Belingueres <be...@gmail.com>.
Did you configure Tomcat to return the proxy proxyName and proxyPort?

The doc is here:
http://tomcat.apache.org/tomcat-5.5-doc/proxy-howto.html

I'm not *actually* sure if relative path redirects would be supported,
I always concatenate the scheme +":" + serverName +":"+port when doing
redirects.

Gabriel

2010/6/16 Jan Fröhlich <Ja...@infomotion.de>:
> Hi Gabriel,
>
> thanks for your quick response.
> Maybe I have to add some information so you can pbb. help me.
>
> My app server is a tomcat 5.5 configured with just a http/Port 80 connector. The server is reachable from local network with its hostname.
> The reverse proxy is configured to an external address (different from hostname) using https.
> So I guess configuring the tomcat to use the external names for host / port would lead to problems with requests from local network.
>
> Reverse Proxy configuration looks like that:
> ProxyPass /myApp http://serverHostname/myApp
> ProxyPassReverse /myApp http://serverHostname/myApp
>
> Thanks again!
>
> Jan
>
> -----Ursprüngliche Nachricht-----
> Von: Gabriel Belingueres [mailto:belingueres@gmail.com]
> Gesendet: Mittwoch, 16. Juni 2010 17:54
> An: Struts Users Mailing List
> Betreff: Re: [s2] Strange behaviour of s2 application behind reverse proxy
>
> Make sure your app server is correctly configured to return the
> font-end proxy values when you call:
> -request.getServerName()
> -request.getServerPort()
>
> Gabriel
>
> 2010/6/16 Jan Fröhlich <Ja...@infomotion.de>:
>> Hi all,
>>
>>
>>
>> after (nearly) finishing a struts2 project with struts 2.1.8.1 we have an odd issue testing the application behind an apache reverse proxy server.
>>
>>
>>
>> In web.xml is "index.jsp" as welcome page defined. Index.jsp contains just a <% response.sendRedirect("home.action") %> (please don't ask if its necessary).
>>
>> Home.action is secured by an LoginInterceptor that checks for a valid session in some backend system and redirects to login.action if the session is invalid.
>>
>> After a successful login through a login form, the home.action is called.
>>
>>
>>
>> In our test environment everything works fine with http. When we test it with https behind an apache reverse proxy every redirect described above leads to a switch in the protocol from https to http. Once the home.action is loaded, and the following calls are made with jQuery, everything works fine.
>>
>>
>>
>> There is no absolute link in the application, we are always using relative paths.
>>
>>
>>
>> Any help appreciated!!
>>
>>
>>
>> Regards,
>>
>> Jan
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: [s2] Strange behaviour of s2 application behind reverse proxy

Posted by Jan Fröhlich <Ja...@infomotion.de>.
Hi Gabriel,

thanks for your quick response. 
Maybe I have to add some information so you can pbb. help me.

My app server is a tomcat 5.5 configured with just a http/Port 80 connector. The server is reachable from local network with its hostname.
The reverse proxy is configured to an external address (different from hostname) using https.
So I guess configuring the tomcat to use the external names for host / port would lead to problems with requests from local network.

Reverse Proxy configuration looks like that:
ProxyPass /myApp http://serverHostname/myApp
ProxyPassReverse /myApp http://serverHostname/myApp

Thanks again!

Jan

-----Ursprüngliche Nachricht-----
Von: Gabriel Belingueres [mailto:belingueres@gmail.com] 
Gesendet: Mittwoch, 16. Juni 2010 17:54
An: Struts Users Mailing List
Betreff: Re: [s2] Strange behaviour of s2 application behind reverse proxy

Make sure your app server is correctly configured to return the
font-end proxy values when you call:
-request.getServerName()
-request.getServerPort()

Gabriel

2010/6/16 Jan Fröhlich <Ja...@infomotion.de>:
> Hi all,
>
>
>
> after (nearly) finishing a struts2 project with struts 2.1.8.1 we have an odd issue testing the application behind an apache reverse proxy server.
>
>
>
> In web.xml is "index.jsp" as welcome page defined. Index.jsp contains just a <% response.sendRedirect("home.action") %> (please don't ask if its necessary).
>
> Home.action is secured by an LoginInterceptor that checks for a valid session in some backend system and redirects to login.action if the session is invalid.
>
> After a successful login through a login form, the home.action is called.
>
>
>
> In our test environment everything works fine with http. When we test it with https behind an apache reverse proxy every redirect described above leads to a switch in the protocol from https to http. Once the home.action is loaded, and the following calls are made with jQuery, everything works fine.
>
>
>
> There is no absolute link in the application, we are always using relative paths.
>
>
>
> Any help appreciated!!
>
>
>
> Regards,
>
> Jan
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [s2] Strange behaviour of s2 application behind reverse proxy

Posted by Gabriel Belingueres <be...@gmail.com>.
Make sure your app server is correctly configured to return the
font-end proxy values when you call:
-request.getServerName()
-request.getServerPort()

Gabriel

2010/6/16 Jan Fröhlich <Ja...@infomotion.de>:
> Hi all,
>
>
>
> after (nearly) finishing a struts2 project with struts 2.1.8.1 we have an odd issue testing the application behind an apache reverse proxy server.
>
>
>
> In web.xml is "index.jsp" as welcome page defined. Index.jsp contains just a <% response.sendRedirect("home.action") %> (please don't ask if its necessary).
>
> Home.action is secured by an LoginInterceptor that checks for a valid session in some backend system and redirects to login.action if the session is invalid.
>
> After a successful login through a login form, the home.action is called.
>
>
>
> In our test environment everything works fine with http. When we test it with https behind an apache reverse proxy every redirect described above leads to a switch in the protocol from https to http. Once the home.action is loaded, and the following calls are made with jQuery, everything works fine.
>
>
>
> There is no absolute link in the application, we are always using relative paths.
>
>
>
> Any help appreciated!!
>
>
>
> Regards,
>
> Jan
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org