apache proxy with rewrite problem
env: cenots5
apache + tomcat (ajp) apache ip:192.168.0.100 port 80 ,vhost domain: www.test.com tomcat1 ip: 192.168.0.101 port 8080 tomcat2 ip:192.168.0.102 port 8080 when visit http://www.test.com/shop/ it actual visit tomcat2 192.168.0.102/shop/index-2000.html and http://www.test.com/shop/bottom/reg.html ----> 192.168.0.102/shop/bottom/reg.html http://www.test.com/shop/other/login.html ----> 192.168.0.102/shop/other/login.html i use apache rewrite and proxy module(related rewrite proxy module has been compiled and loaded) to do it my apache confuguration: Code:
<VirtualHost *:80> Code:
<VirtualHost *:80> my question: it dont work ,why. if i configure apache like this Code:
<VirtualHost *:80> --->192.168.0.102/shop/index-2000.html ok but http://www.test.com/shop/bottom/reg.html ----> 192.168.0.102/shop/bottom/reg.html dont work ! http://www.test.com/shop/other/login.html ----> 192.168.0.102/shop/other/login.html dont work ! why...give me a hint!thx |
Hi,
Please define "dont work !' In the meantime, since the URL you're using is http://www.test.com/shop/, why don't you use: Code:
<VirtualHost *:80> |
Quote:
to hidden part of the url "shop/index-2000.html" if i use ProxyPass / http://192.168.0.102:8080/shop/ ProxyPassReverse / http://192.168.0.102:8080/shop i cant let www.test.com ---> www.test.com/shop/index-2000.html may be rewrite rule has some problem but http://www.test.com/shop/bottom/reg.html ----> 192.168.0.102/shop/bottom/reg.html http://www.test.com/shop/other/login.html ----> 192.168.0.102/shop/other/login.html work fine... under this configuretion , i just want to let entry www.test.com go to www.test.com/shop/index-2000.html |
Hi,
You cannot use mod_rewrite to hide the url, as it runs on apache and for this reason it cannot rewrite urls in tomcat. Even if you stop the reverse proxying of /shop and use mod_rewrite to redirect requests to tomcat, the final url will be shown in the browser address bar, since it's an external rewrite. I guess you have to deploy the application running on 192.168.0.102, so that the context path is /shop and the index page is index-2000.html. There is a way to rewrite urls in tomcat using this filter. I've never used it, so I cannot tell if it fits your needs. Regards |
All times are GMT -5. The time now is 11:06 PM. |