You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Adam Bender <ad...@magpieti.com> on 2010/09/15 03:46:11 UTC

Trouble with ProxyPass and Wicket

Greetings,

I have a quick question about running Wicket behind mod_proxy_ajp
(ProxyPass). I have read the wiki page about front-ending wicket with a
Proxy and it mentions the use of a contextpath parameter to control the
generation of links and such. It doesn't explicitly mention redirects though
- think a protected page that is redirected to a sign in page. However, it
seems that this parameter has no discernable effect.  Is the contextpath
parameter supported in 1.4.9? Ultimately I would like to be able to decouple
the name of the .war file from the actual exposed URL so that I don't have
to rebuild the app if we need to change the URL it is hosted under.

Here is a short sequence of urls that I get when I try to load a protected
page

http://www.webapp.com/client/protectedpage

302 -> http://www.webapp.com/web-app-client/signin

Interestingly, if I point directly to the sign in page all is well which
leads me to believe it is the redirect sent by Wicket that is exposing the
webapp container name.


Below are the relevant configuration files:

.war file is called web-app-client.war and explodes as web-app-client

http.conf

 ProxyPreserveHost on
 ProxyPass /client ajp://localhost:8009/web-app-client/ retry=0
 ProxyPassReverse /client ajp://localhost:8009/web-app-client/
 ProxyPassReverseCookiePath /web-app-client /client


web.xml

<filter>
    <filter-name>wicket.web-app-client</filter-name>

 <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
    <init-param>
        <param-name>applicationClassName</param-name>

 <param-value>com.magpieti.habitchanger.web.client.WebClientApplication</param-value>
    </init-param>
    <init-param>
        <param-name>contextpath</param-name>
        <param-value>/client</param-value>
    </init-param>
</filter>

Thanks,

Adam

Re: Trouble with ProxyPass and Wicket

Posted by Adam Bender <ad...@magpieti.com>.
That seemed to do the trick, thank you very much for your help!

Adam
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Trouble-with-ProxyPass-and-Wicket-tp2539851p2549555.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Trouble with ProxyPass and Wicket

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

Yeah, try something like this:


       RewriteEngine On
       RewriteCond %{SERVER_NAME} !^www\.mydomain\.com
       RewriteRule /(.*) http://www.mydomain.com/$1 [redirect=301L]

*
*Martin

2010/9/15 Igor Vaynberg <ig...@gmail.com>:
> it is most likely the servlet container. wicket passes in a relative
> url to the servlet container's response#sendredirect, and it is the
> servlet container's job to rewrite that relative url to an absolute
> one - because all redirects must be absolute.
>
> sounds like your proxy is not rewriting those redirect urls.
>
> -igor
>
> On Tue, Sep 14, 2010 at 6:46 PM, Adam Bender <ad...@magpieti.com> wrote:
>> Greetings,
>>
>> I have a quick question about running Wicket behind mod_proxy_ajp
>> (ProxyPass). I have read the wiki page about front-ending wicket with a
>> Proxy and it mentions the use of a contextpath parameter to control the
>> generation of links and such. It doesn't explicitly mention redirects though
>> - think a protected page that is redirected to a sign in page. However, it
>> seems that this parameter has no discernable effect.  Is the contextpath
>> parameter supported in 1.4.9? Ultimately I would like to be able to decouple
>> the name of the .war file from the actual exposed URL so that I don't have
>> to rebuild the app if we need to change the URL it is hosted under.
>>
>> Here is a short sequence of urls that I get when I try to load a protected
>> page
>>
>> http://www.webapp.com/client/protectedpage
>>
>> 302 -> http://www.webapp.com/web-app-client/signin
>>
>> Interestingly, if I point directly to the sign in page all is well which
>> leads me to believe it is the redirect sent by Wicket that is exposing the
>> webapp container name.
>>
>>
>> Below are the relevant configuration files:
>>
>> .war file is called web-app-client.war and explodes as web-app-client
>>
>> http.conf
>>
>>  ProxyPreserveHost on
>>  ProxyPass /client ajp://localhost:8009/web-app-client/ retry=0
>>  ProxyPassReverse /client ajp://localhost:8009/web-app-client/
>>  ProxyPassReverseCookiePath /web-app-client /client
>>
>>
>> web.xml
>>
>> <filter>
>>    <filter-name>wicket.web-app-client</filter-name>
>>
>>  <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>>    <init-param>
>>        <param-name>applicationClassName</param-name>
>>
>>  <param-value>com.magpieti.habitchanger.web.client.WebClientApplication</param-value>
>>    </init-param>
>>    <init-param>
>>        <param-name>contextpath</param-name>
>>        <param-value>/client</param-value>
>>    </init-param>
>> </filter>
>>
>> Thanks,
>>
>> Adam
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Trouble with ProxyPass and Wicket

Posted by Igor Vaynberg <ig...@gmail.com>.
it is most likely the servlet container. wicket passes in a relative
url to the servlet container's response#sendredirect, and it is the
servlet container's job to rewrite that relative url to an absolute
one - because all redirects must be absolute.

sounds like your proxy is not rewriting those redirect urls.

-igor

On Tue, Sep 14, 2010 at 6:46 PM, Adam Bender <ad...@magpieti.com> wrote:
> Greetings,
>
> I have a quick question about running Wicket behind mod_proxy_ajp
> (ProxyPass). I have read the wiki page about front-ending wicket with a
> Proxy and it mentions the use of a contextpath parameter to control the
> generation of links and such. It doesn't explicitly mention redirects though
> - think a protected page that is redirected to a sign in page. However, it
> seems that this parameter has no discernable effect.  Is the contextpath
> parameter supported in 1.4.9? Ultimately I would like to be able to decouple
> the name of the .war file from the actual exposed URL so that I don't have
> to rebuild the app if we need to change the URL it is hosted under.
>
> Here is a short sequence of urls that I get when I try to load a protected
> page
>
> http://www.webapp.com/client/protectedpage
>
> 302 -> http://www.webapp.com/web-app-client/signin
>
> Interestingly, if I point directly to the sign in page all is well which
> leads me to believe it is the redirect sent by Wicket that is exposing the
> webapp container name.
>
>
> Below are the relevant configuration files:
>
> .war file is called web-app-client.war and explodes as web-app-client
>
> http.conf
>
>  ProxyPreserveHost on
>  ProxyPass /client ajp://localhost:8009/web-app-client/ retry=0
>  ProxyPassReverse /client ajp://localhost:8009/web-app-client/
>  ProxyPassReverseCookiePath /web-app-client /client
>
>
> web.xml
>
> <filter>
>    <filter-name>wicket.web-app-client</filter-name>
>
>  <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>    <init-param>
>        <param-name>applicationClassName</param-name>
>
>  <param-value>com.magpieti.habitchanger.web.client.WebClientApplication</param-value>
>    </init-param>
>    <init-param>
>        <param-name>contextpath</param-name>
>        <param-value>/client</param-value>
>    </init-param>
> </filter>
>
> Thanks,
>
> Adam
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org