File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Question about portforwarding and tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Question about portforwarding and tomcat" Watch "Question about portforwarding and tomcat" New topic

Question about portforwarding and tomcat

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Hi guys, Our app would be running on a Linux server. Most probably, no one wants to view their domain as, so we set port forwards to port 80 so every request that comes through it forwards to port 8080, is this correct? My app is accessed by invoking myipaddress:8080/myappname, if the visitors to my site would just type, how do I make sure that it points correctly to my app? Thanks!

SCJP 1.5
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Well you can do the same thing in Tomcat itself.

Change your port number to 80 from 8080 form server.xml of tomcat, then you don't require any port number.


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Yes, but on the Linux environment you have to be running as root. I need to be running as a non-root account. And even on windows, you still have to be invoking which is ugly. I want it to be just

I'm also running apache web server which is in port 80, thank you
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

What you're doing is fine.

Some other alternatives:
  • Use a connector to have Apache HTTPD forward requests to Tomcat (More hassle than it's worth to me).
  • Use the jakarta/commons/daemon to bind to port 80 as root and then downgrade itself to a lesser user for running Tomcat (the same way Apache HTTPD works).
  • Set up an iptables rule that to do port re-direction at a kernel level.

  • Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    I agree. Here's the link:
    subject: Question about portforwarding and tomcat
    It's not a secret anymore!