Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Question about portforwarding and tomcat

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys, Our app would be running on a Linux server. Most probably, no one wants to view their domain as mydomain.com:8080, 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 mydomainname.com, how do I make sure that it points correctly to my app? Thanks!
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Naseem
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 http://mydomain.com:8080/myapp which is ugly. I want it to be just http://mydomain.com.


I'm also running apache web server which is in port 80, thank you
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

  •  
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic