You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2005/09/21 14:12:28 UTC

Absolutizing with request.getServerName() (was: Protocol switch...)

Le 21 sept. 05, à 14:04, BURGHARD Éric a écrit :
> ....If i understand correctly, the request.getServerName() is not 
> useable for
> absolutisation since it names the server in his local environnement..

Did you follow Vadim's advice earlier in this thread?

Le 19 sept. 05, à 14:45, Vadim Gritsenko a écrit :
> ...Use ProxyPreserveHost
>
> http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypreservehost

I think request.getServerName() should return the correct value then.

-Bertrand


Re: Absolutizing with request.getServerName() (was: Protocol switch...)

Posted by BURGHARD Éric <er...@systheo.com>.
Bertrand Delacretaz wrote:

> Le 21 sept. 05, à 14:04, BURGHARD Éric a écrit :
>> ....If i understand correctly, the request.getServerName() is not
>> useable for
>> absolutisation since it names the server in his local environnement..
> 
> Did you follow Vadim's advice earlier in this thread?
> 
> Le 19 sept. 05, à 14:45, Vadim Gritsenko a écrit :
>> ...Use ProxyPreserveHost
>>
>> http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypreservehost
> 
> I think request.getServerName() should return the correct value then.
> 

Yes but for me it's going to far in virtual host or http server
configuration and it's tied to a particular http server configuration.

getServerName() apparently
"Returns the host name of the server that received the request"
which not what you want i guess.

getHeader('Host') is preferable as it returns the name that appears in the
client's browser.

for me a prefix constructed from sitemap with
<map:parameter name="site"
value="{request:scheme}://{request-header:Host}/{request:contextPath}"/>
seems to work well to absolutize my urls (i'm using apache+tomcat5).

Regards.