Reputation: 21277
I have deployed my Wicket app at /myapp in Tomcat, and I have put it behind Apache web server using
ProxyPass / http://localhost:8080/myapp/
ProxyPassReverse / http://localhost:8080/myapp/
Now Wicket incorrectly redirect users to /myapp/xxx instead of /xxx.
Is there any way to make Wicket(1.3.5) use / as my root path (instead of /myapp which is servlet deployment context path)?!
Edit: There is a solution described at following link but it doesn't works for 1.3.5 version: I found it: https://cwiki.apache.org/WICKET/wicket-behind-a-front-end-proxy.html
Edit: The problem is that wicket uses relative path redirects with ServletResponse#sendRedirect and Tomcat convert them to absolutes redirects containing /myapp at beginning. I have tried mod_jk(AJP) but there was no difference!
There should be some way to tell proxy-pass or mod-jk to rewrite redirects before sending them to client!
Upvotes: 1
Views: 2013
Reputation: 19478
You may find this Tomcat document helpful:
http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html
It addresses the above situation with RedirectMatch and mod_rewrite.
Upvotes: 0
Reputation: 21277
I didn't find direct answer but used following workaround with mod jk, I guess it is also possible to do with proxy pass.
RewriteRule /myapp/(.*) /$1 [L,R]
RewriteRule ^(.*) /myapp$1 [PT]
JkMount /myapp/* ajp13_worker
First line redirects request coming from client starting with /myapp/* (which are result of incorrect Wicket/Tomcat/Apache redirects) to /*.
Second line rewrites all requests from /* to /myapp/* and third line send them to tomcat.
For proxy pass, third line should be replaced with:
ProxyPass /myapp/ http://localhost:8080/myapp/
ProxyPassReverse /myapp/ http://localhost:8080/myapp/
Upvotes: 1