File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Redirect a tomcat application URL and port using apache. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Redirect a tomcat application URL and port using apache." Watch "Redirect a tomcat application URL and port using apache." New topic
Author

Redirect a tomcat application URL and port using apache.

sudhesh nair
Greenhorn

Joined: Jun 17, 2011
Posts: 1



I have multiple jvm instance of tomcat application on a unix server and its running on different port.i would like to
redirect the port and uri.How can i achieve this with the help of apache. i heard we can do it using mod_proxy.

http://myapp.xx.com:18120/offers-service-main (Actual URL)


http://myapp.xx.com/offer -when the user access this url this should get redirect to http://myapp.xx.com:18120/offers-service-main


Currently when i access http://myapp.xx.com/offer i get 404 error.

one way to achieve this is to rename my exploded app name (offers-service-main) to offer. But i dont want to do that.anyway to achieve it.


This what i have done from my side.

1) installed apache 2.2 with mod_proxy


./configure --prefix=/usr/local/apache2.0 \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-http

2) Added the below config in apache


ProxyRequests Off
ProxyPreserveHost On
ProxyPass /offer http://myapp.xx.com:18120/offers-service-main
ProxyPassReverse /offer http://myapp.xx.com:18120/offers-service-main

But the above configuration dosent seems to be work. Let me know if i need to do anything on the tomcat side. Thank you
 
GeeCON Prague 2014
 
subject: Redirect a tomcat application URL and port using apache.