• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hiding port number in URL

 
Mithun Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have set up a J2EE application in Tomcat container in an RHEL5.3 server.
It is working fine when I give http://localhost:8080/abcd/..../*.jsp
But I want to hide the 8080 port number. i.e If I give http://localhost/abcd/..../*.jsp it should work. Is this possible?
Currently, when I try it after starting Apache and Tomcat, the code of the JSP page gets displayed in the browser.

Thanks in advance.
 
Imran Akbar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the port to 80 instead of 8080 in server.xml in tomcat's conf directory



and restart.

some one has other solutions please post.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18282
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't "hide" the port number. A URL isn't primarily something to be displayed, it's something used to make a request. That's why it's called a Uniform Resource Locator.

As Imran has pointed out, you can reconfigure Tomcat to listen on Port 80 - assuming that no other server such as Apache or IIS is using it. However, that's not really "hiding" the port number, just taking advantage of the fact that an HTTP URL has an implied ":80" in in.
 
Mithun Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies...
Actually, I have Apache server configured in Port 80. Therefore when I give, http://localhost/abcd/..../*.jsp it is going to the Apache server. Is it possible to redirect to Tomcat from there?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11917
209
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Tomcat-Apache HOWTO has the information you need. It is quite easy to have Apache HTTPD fronting Tomcat, and is one of the recommended configurations.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18282
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Traditionally, the way to link up Apache httpd and Tomcat was to use a Tomcat connector such as the coyote/mod_jk connector.

Eventually this is probably going to be phased out, as Apache has been modified to be able to use its mod_proxy module for linking Apache and Tomcat. At the moment, as I understand it, there are still cases where mod_jk is necessary, but I do have one server happily running using mod_proxy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic