You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> on 2008/06/23 21:42:57 UTC

[users@httpd] Re: howto query which domain?

Hi I have a vhost which has several serveraliases, how can I check for 
which one is being triggered?

Something like this:

if serveralias="myalias" then{
  RequestHeadder add domain "myalias"
}

I've tried location, but it does not seem to be the thing..


-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: howto query which domain?

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hmm, it never sets rdomain to any thing other than rdomain... how can I 
use the variable im doing it like this now:

SetEnvIf Host "\.([^.]+\.dk)$" rdomain=$1
RequestHeader set domain rdomain

and that just adds a header called domain with content "rdomain", and 
yes the last bit of the host are .dk or .eu

André Warnier wrote:
> Something like
>
> SetEnvIf Host "\.([^.]+\.com)$" rdomain=$1
>
> should set an environment variable rdomain to the real domain of the 
> request.
> Now what you do after that with the rdomain variable...
>
> André
>
>
> Nino Saturnino Martinez Vazquez Wael wrote:
>> Hehe, sure. And thanks for pointing it out.
>>
>> I have a site(tomcat) which has several serveraliase's and im trying 
>> todo a little specific skinning per serveralias. But todo that I need 
>> to be able to see which server the request are comming through,  I've 
>> tried using preservehosts on. That works, somewhat, however I get 
>> this appended www.domain.com/ZeuzWeb-0.1-SNAPSHOT/ instead of 
>> www.domain.com/.
>>
>> Heres a snip of my vhost file:
>>
>> <VirtualHost *:* 
>>  >                                                                                                                                         
>>
>> ServerName beta.domain0.com 
>>                                                                                                                           
>>
>> ServerAlias *.mydomain1.com 
>>                                                                                                                             
>>
>>    ProxyPass /images 
>> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/images                                                                                     
>>
>>    ProxyPass / 
>> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                                 
>>
>>    ProxyPassReverse / 
>> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                          
>>
>>    ProxyPassReverseCookiePath /ZeuzWeb-0.1-SNAPSHOT 
>> /                                                                                                     
>>
>>    <Proxy 
>> *>                                                                                                                                              
>>
>>    Order 
>> deny,allow                                                                                                                                       
>>
>>    Allow from 
>> all                                                                                                                                         
>>
>>    
>> </Proxy>                                                                                                                                               
>>
>> RequestHeader set domain 
>> Host                                                                                                                              
>>
>>                                                                                                                                                           
>>
>> </VirtualHost>                     The request header  part are 
>> actually set, however it always sets it to domain0.com, and never the 
>> server alias. So I wanted a method to set the header to either 
>> domain0 or mydomain1. If this is possible another better way id be 
>> happy not matter what:)
>>
>> André Warnier wrote:
>>>
>>>
>>> Nino Saturnino Martinez Vazquez Wael wrote:
>>>> Hi I have a vhost which has several serveraliases, how can I check 
>>>> for which one is being triggered?
>>>>
>>>> Something like this:
>>>>
>>>> if serveralias="myalias" then{
>>>>  RequestHeadder add domain "myalias"
>>>> }
>>>>
>>>> I've tried location, but it does not seem to be the thing..
>>>>
>>>>
>>> I kind of presume you are talking about Apache, but
>>> like, in what, with what, how, why , where, for what ?
>>> Could you be a little more specific ?
>>> ;-)
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server 
>>> Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: howto query which domain?

Posted by André Warnier <aw...@ice-sa.com>.
Something like

SetEnvIf Host "\.([^.]+\.com)$" rdomain=$1

should set an environment variable rdomain to the real domain of the 
request.
Now what you do after that with the rdomain variable...

André


Nino Saturnino Martinez Vazquez Wael wrote:
> Hehe, sure. And thanks for pointing it out.
> 
> I have a site(tomcat) which has several serveraliase's and im trying 
> todo a little specific skinning per serveralias. But todo that I need to 
> be able to see which server the request are comming through,  I've tried 
> using preservehosts on. That works, somewhat, however I get this 
> appended www.domain.com/ZeuzWeb-0.1-SNAPSHOT/ instead of www.domain.com/.
> 
> Heres a snip of my vhost file:
> 
> <VirtualHost *:* 
>  >                                                                                                                                         
> 
> ServerName beta.domain0.com 
>                                                                                                                           
> 
> ServerAlias *.mydomain1.com 
>                                                                                                                             
> 
>    ProxyPass /images 
> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/images                                                                                     
> 
>    ProxyPass / 
> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                                 
> 
>    ProxyPassReverse / 
> http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                          
> 
>    ProxyPassReverseCookiePath /ZeuzWeb-0.1-SNAPSHOT 
> /                                                                                                     
> 
>    <Proxy 
> *>                                                                                                                                              
> 
>    Order 
> deny,allow                                                                                                                                       
> 
>    Allow from 
> all                                                                                                                                         
> 
>    
> </Proxy>                                                                                                                                               
> 
> RequestHeader set domain 
> Host                                                                                                                              
> 
>                                                                                                                                                           
> 
> </VirtualHost>                     
> The request header  part are actually set, however it always sets it to 
> domain0.com, and never the server alias. So I wanted a method to set the 
> header to either domain0 or mydomain1. If this is possible another 
> better way id be happy not matter what:)
> 
> André Warnier wrote:
>>
>>
>> Nino Saturnino Martinez Vazquez Wael wrote:
>>> Hi I have a vhost which has several serveraliases, how can I check 
>>> for which one is being triggered?
>>>
>>> Something like this:
>>>
>>> if serveralias="myalias" then{
>>>  RequestHeadder add domain "myalias"
>>> }
>>>
>>> I've tried location, but it does not seem to be the thing..
>>>
>>>
>> I kind of presume you are talking about Apache, but
>> like, in what, with what, how, why , where, for what ?
>> Could you be a little more specific ?
>> ;-)
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server 
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: howto query which domain?

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hehe, sure. And thanks for pointing it out.

I have a site(tomcat) which has several serveraliase's and im trying 
todo a little specific skinning per serveralias. But todo that I need to 
be able to see which server the request are comming through,  I've tried 
using preservehosts on. That works, somewhat, however I get this 
appended www.domain.com/ZeuzWeb-0.1-SNAPSHOT/ instead of www.domain.com/.

Heres a snip of my vhost file:

<VirtualHost *:* 
 >                                                                                                                                         

ServerName beta.domain0.com 
                                                                                                                           

ServerAlias *.mydomain1.com 
                                                                                                                             

    ProxyPass /images 
http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/images                                                                                     

    ProxyPass / 
http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                                 

    ProxyPassReverse / 
http://10.0.0.2:8180/ZeuzWeb-0.1-SNAPSHOT/                                                                                          

    ProxyPassReverseCookiePath /ZeuzWeb-0.1-SNAPSHOT 
/                                                                                                     

    <Proxy 
*>                                                                                                                                              

    Order 
deny,allow                                                                                                                                       

    Allow from 
all                                                                                                                                         

    
</Proxy>                                                                                                                                               

RequestHeader set domain 
Host                                                                                                                              

                                                                                                                                                           

</VirtualHost>                      

The request header  part are actually set, however it always sets it to 
domain0.com, and never the server alias. So I wanted a method to set the 
header to either domain0 or mydomain1. If this is possible another 
better way id be happy not matter what:)

André Warnier wrote:
>
>
> Nino Saturnino Martinez Vazquez Wael wrote:
>> Hi I have a vhost which has several serveraliases, how can I check 
>> for which one is being triggered?
>>
>> Something like this:
>>
>> if serveralias="myalias" then{
>>  RequestHeadder add domain "myalias"
>> }
>>
>> I've tried location, but it does not seem to be the thing..
>>
>>
> I kind of presume you are talking about Apache, but
> like, in what, with what, how, why , where, for what ?
> Could you be a little more specific ?
> ;-)
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: howto query which domain?

Posted by André Warnier <aw...@ice-sa.com>.

Nino Saturnino Martinez Vazquez Wael wrote:
> Hi I have a vhost which has several serveraliases, how can I check for 
> which one is being triggered?
> 
> Something like this:
> 
> if serveralias="myalias" then{
>  RequestHeadder add domain "myalias"
> }
> 
> I've tried location, but it does not seem to be the thing..
> 
> 
I kind of presume you are talking about Apache, but
like, in what, with what, how, why , where, for what ?
Could you be a little more specific ?
;-)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org