I am using apache on 80 port, that sending all demands on tomcat6 on port 8080. During my application I am using struts2 framework. In tomcat I am using redirect from ROOT application to my application "MyApp".
After I walk around the links on my small site I see good Web addresses like www.mysite.com/order
However when struts redirects me anywhere Web addresses go ahead and take form like www.mysite.com:8080/MyApp/order
Steps to make this Web addresses simmilar?
How's it going doing the sending? The right way is to setup Apache as reverse proxy using mod_proxy. See here for instructions. By doing this there won't be any trouble with Struts redirects.
I actually do it while using AJP connector between Apache and Tomcat. Here is a snippet of the items I personally use during my config files:
A part of Apache's configuration ($APACHE_DIR/sites-available/default):
NameVirtualHost *:80 NameVirtualHost *:443 LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so JkWorkersFile /etc/apache2/workers.conf JkLogFile /var/log/apache2/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " <VirtualHost *:80> ServerName brasee.com ServerAlias www.brasee.com JkMount /* ajp13secured </VirtualHost>
A part of Tomcat's configuration (conf/server.xml):
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- Define an AJP 1.3 Connector on port 8008 --> <Connector port="8008" protocol="AJP/1.3" redirectPort="8080" />