Tomcat – How to remove the port number from Tomcat urls

apache-2.2tomcat

I have Groovy on Grails app deployed on Tomcat/Apache (CentOS). Currently, it is accessed via a URL like http://www.domain.com:8080/AppName. I would like to access it via http://www.domain.com.

How do I go about this?

Best Answer

I assume that you are trying to move http://www.domain.com:8080/AppName to http://www.domain.com/ without the trailing AppName. In that case, you may want to consider running a reverse proxy in front of Tomcat. Merely switching the port from port 8080 to 80 would still require you to access your app via http://www.domain.com/AppName.

Apache can be configured to do this. You will just need to set up mod_proxy with the following config:

ProxyPass / http://localhost:8080/AppName/
ProxyPassReverse / http://localhost:8080/AppName/

You can also do this with other web-servers such as lighttpd or nginx and what nots, basically most reverse proxies can do it in one form or another.

Related Topic