You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Travis Stevens <Tr...@noaa.gov> on 2004/08/11 18:30:58 UTC

html base tag

I have been using the struts html base tag.  Unfortunately, our new 
staging machine is done with a proxy pass.  This means that the URL 
being sent to the box in which the tomcat is located is changed and the 
base is then wrong.

For example:

www.outside_firewall.com/tomcat

is proxy passed to

www.inside_firewall.com/tomcat

which means when the page returns to the client, the base tag is
<base href="www.inside_firewall.com/tomcat">

Currently the base tag determines the server via the following

1. Passed as parameter?
2. request.getServer()

I would like to add another step
1. Passed as parameter?
2. An init parameter in the ServletContext instance?
3. request.getServer()

In order to do this, I will add a field to Global entitled SERVER with 
value "server" which can be configured in web.xml.  I will then access 
that variable via the ServletContext in the BaseTag class.

Does this sound feasible?  Any other ideas?  Is this something I should 
submit to be added to struts?

-Trav


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


Re: html base tag

Posted by Craig McClanahan <cr...@gmail.com>.
On Wed, 11 Aug 2004 10:30:58 -0600, Travis Stevens
<tr...@noaa.gov> wrote:
> I have been using the struts html base tag.  Unfortunately, our new
> staging machine is done with a proxy pass.  This means that the URL
> being sent to the box in which the tomcat is located is changed and the
> base is then wrong.
> 

The strategy you lay out will probably work, but it's a lot of effort
and means you'll be forever patching new versions of Struts with your
custom changes.  Far better would be to get Tomcat to stop lying to
you about the incoming server name and port:

    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/proxy-howto.html

Solving the real problem will make your Struts apps work correctly,
along with every other web appication that is based on servlet
technology.  They will all assume that getServerName() and
getServerPort() return the right things.

Craig


> For example:
> 
> www.outside_firewall.com/tomcat
> 
> is proxy passed to
> 
> www.inside_firewall.com/tomcat
> 
> which means when the page returns to the client, the base tag is
> <base href="www.inside_firewall.com/tomcat">
> 
> Currently the base tag determines the server via the following
> 
> 1. Passed as parameter?
> 2. request.getServer()
> 
> I would like to add another step
> 1. Passed as parameter?
> 2. An init parameter in the ServletContext instance?
> 3. request.getServer()
> 
> In order to do this, I will add a field to Global entitled SERVER with
> value "server" which can be configured in web.xml.  I will then access
> that variable via the ServletContext in the BaseTag class.
> 
> Does this sound feasible?  Any other ideas?  Is this something I should
> submit to be added to struts?
> 
> -Trav
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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