You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Oleg Bartunov <ol...@sai.msu.su> on 2000/03/12 11:43:57 UTC

How to get SERVER_NAME of frontend ?

Hi,

sorry if it's dummy question. I need to know in script, running
in backend side, SERVER_NAME of frontend which proxying request 
through mod_proxy.


	Regards,

		Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


Re: How to get SERVER_NAME of frontend ?

Posted by Sean Dague <sd...@raleigh.ibm.com>.
> >http://some.server:someport/some/url/$1?ip=%{LA-U:REMOTE_HOST} [QSA,P]
> Do you really need the LA-U: form here for REMOTE_HOST?

Doh... right.  My afternoon session in learning all of this stuff clearly
left me with some confusion, thanks for pointing that out.

	-Sean

Sean Dague 
IBM Global Services
email: sdague@raleigh.ibm.com
alt-email: sldague@us.ibm.com

There is no silver bullet.  Plus, werewolves make better neighbors than
zombies, and they tend to keep the vampire population down.


Re: How to get SERVER_NAME of frontend ?

Posted by Bill Moseley <mo...@hank.org>.
At 11:12 AM 03/13/00 -0500, Sean Dague wrote:
>RewriteEngine On
>RewriteLog /somewhere/rewrite.log
>RewriteLogLevel 3
>RewriteRule ^/some/url(.*)$
>http://some.server:someport/some/url/$1?ip=%{LA-U:REMOTE_HOST} [QSA,P]

Do you really need the LA-U: form here for REMOTE_HOST?




Bill Moseley
mailto:moseley@hank.org

Re: How to get SERVER_NAME of frontend ?

Posted by Sean Dague <sd...@raleigh.ibm.com>.
> sorry if it's dummy question. I need to know in script, running
> in backend side, SERVER_NAME of frontend which proxying request 
> through mod_proxy.

Oleg,

I had to do something similar not to long ago.  Using mod_rewrite was the
quickest and easiest way to do this.  Compile apache with both mod_proxy
and mod_rewrite, then use a directive something like this

RewriteEngine On
RewriteLog /somewhere/rewrite.log
RewriteLogLevel 3
RewriteRule ^/some/url(.*)$
http://some.server:someport/some/url/$1?ip=%{LA-U:REMOTE_HOST} [QSA,P]

This will have all the urls starting with /some/url proxied off to the
other server at the same url.  It will append the REMOTE_HOST header as a
query string arguement. (QSA = Query String Append, P = Proxy)  Works
really hip.  There is probably a way to remap it as an X-Header of
somesort, but if query string is good enough for you, then this should
work really nicely.

	-Sean

Sean Dague 
IBM Global Services
email: sdague@raleigh.ibm.com
alt-email: sldague@us.ibm.com

There is no silver bullet.  Plus, werewolves make better neighbors than
zombies, and they tend to keep the vampire population down.