You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gabriel W." <ga...@ezwebtools.com> on 2004/01/10 04:53:47 UTC

Included port numbers in web links e.g. 8080

Hi,

I am relatively new to this list so I do not know if this topic was discussed before (I checked the archive and it does not appear that way).

It seems that Struts includes the ServerPort in web links if not of the values 80 or 443 (e.g. http://mydomain.com:8080). In some cases this is not the welcomed behavior.
Specifically if the Struts server is listening on Port 8080 behind a firewall. The firewall receives the request from the outside
internet on port 80 and routes it to the machine listening on Port 8080.  

The Struts machine in this case does not know the difference and so includes the Port 8080.

I looked at the Struts source code I assume is behind the logic (org.apache.struts.taglib.html.BaseTag), and it
does not appear as though there is a configuration flag to turn this logic on/off.

Are there any considerations for such an option in the future so that a firewalled site won't have to show 8080.

NOTE: This is a situation where the Struts server does not have permission to listen on Port 80.

Regards,
Gabe

Re: Included port numbers in web links e.g. 8080

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Quoting "Gabriel W." <ga...@ezwebtools.com>:

> Hi,
> 
> I am relatively new to this list so I do not know if this topic was discussed
> before (I checked the archive and it does not appear that way).
> 
> It seems that Struts includes the ServerPort in web links if not of the
> values 80 or 443 (e.g. http://mydomain.com:8080). In some cases this is not
> the welcomed behavior.
> Specifically if the Struts server is listening on Port 8080 behind a
> firewall. The firewall receives the request from the outside
> internet on port 80 and routes it to the machine listening on Port 8080.  
> 
> The Struts machine in this case does not know the difference and so includes
> the Port 8080.
> 
> I looked at the Struts source code I assume is behind the logic
> (org.apache.struts.taglib.html.BaseTag), and it
> does not appear as though there is a configuration flag to turn this logic
> on/off.
> 
> Are there any considerations for such an option in the future so that a
> firewalled site won't have to show 8080.
> 
> NOTE: This is a situation where the Struts server does not have permission to
> listen on Port 80.
> 
> Regards,
> Gabe
> 

Struts is basing its decision on the port returned by calling
ServletRequest.getServerPort() -- in other words, if you've got a server or
proxy that receives requests on port 80 and internally redirects them to some
other port, there's absolutely no way that Struts can know what the right port
number is unless your servlet container can tell it.

For situations like Tomcat running behind an Apache HTTPD server, this normally
gets taken care of you automatically.  If you've got a different situation,
you'll need to figure out how to tell your servlet container to adjust the
server port it reports -- there's nothing Struts can do to help.

Craig McClanahan




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org