It's not a secret anymore!
The moose likes Tomcat and the fly likes req.getServerName() and req.getServerPort() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "req.getServerName() and req.getServerPort()" Watch "req.getServerName() and req.getServerPort()" New topic

req.getServerName() and req.getServerPort()

Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99

I have a web app running on JBoss that relies on the req.getServerName() and req.getServerPort() to generate invitation emails for new users. I have:

req.getServerPort() = 80
req.getServerName() =

and everything works fine. If I add an Apache server on port 80 the box that redirects the request to JBoss on 8080, I have:

req.getServerPort() = 8080
req.getServerName() =

and that's not nice. As that's not very useful indeed to the user :-(

Did I set anything wrong in Apache or is a flow in my app design?




Renato Losio - -
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Moved from Servlets to Apache/Tomcat

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: req.getServerName() and req.getServerPort()
It's not a secret anymore!