views:

35

answers:

1

Hi all when i tried to get the requested url on some page on myapp.com i get something like : http://127.0.0.1:8084/myapp/mypage

and it was expected to be: http://myapp.com/mypage

i think that this is because Apache acts as a Mediator between the tomcat and the user requests/responses

any ideas guys why such behaviour occurs, and how to fix it ? thanks

A: 

How are you connecting your Apache to your Java Application server?

If you are using a plain reverse proxy (mod_proxy), what you are getting is what's expected. You won't be able to change that because of reverse proxy's nature.

On the other hand, if you are using AJP (with mod_ajp, or mod_jk) you should be getting http://myapp.com/mypage.

My suggestion is, change to AJP if you are using a plain reverse proxy.

Pablo Santa Cruz
i used ajp, it gets the url correctly, but the problem is it makes a bad redirection for example: if you want to access the page mypage it goes to http://myapp.com/myapp/mypage but it should go to http://myapp.com/mypage.
sword101
Show me how you do the redirection (in httpd.conf configuration).
Pablo Santa Cruz
<Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://127.0.0.1:8009/myapp/ ProxyPassReverse / ajp://127.0.0.1:8009/myapp/ ProxyPassReverseCookiePath /myapp/
sword101
Change it to: `ProxyPass /myapp/ ajp://127.0.0.1:8009/myapp`
Pablo Santa Cruz
Redirects should work if you do that.
Pablo Santa Cruz
If you don't want `myapp` to appear in your `URLs` at all, you can configure `TOMCAT` to serve in the root `/` path your application and redirects should also work.
Pablo Santa Cruz
i can see the apache go to the app but i don know why my app add appname to the url again to be HTTP Status 404 - /appname/appname/dir/page it should be /dir/page
sword101
any other ideas, i am run out of ideas, i tried everything, but this stupid problem still there.
sword101