• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hiding port number in URL

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic