Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: RewriteCond/RewriteRule + Proxy configuration question |
|
Author |
|
andrec
Joined: 07 Mar 2014 Posts: 1 Location: Canada,Ottawa
|
Posted: Fri 07 Mar '14 19:25 Post subject: RewriteCond/RewriteRule + Proxy configuration question |
|
|
Hi,
We are using Apache/2.2.25 (Unix)
I'm trying to combine all my virtual host into a single config and have issues.
Basically all my vhost are very similar except for couple changes.
To simplify I have rename all
Code: |
RewriteEngine On
RewriteRule ^ - [E=SITE:DefaultSite]
RewriteRule ^ - [E=PARTNERNAME:DefaultPartner]
RewriteCond %{HTTP_HOST} ^partner_1\.domain\.com [NC]
RewriteRule ^ - [E=SITE:P1Site]
RewriteRule ^ - [E=PARTNERNAME:Partner1]
RewriteCond %{HTTP_HOST} ^partner_2\.domain\.com [NC]
RewriteRule ^ - [E=SITE:P2Site]
RewriteRule ^ - [E=PARTNERNAME:Partner2]
RewriteCond %{HTTP_HOST} ^partner_3\.domain\.com [NC]
RewriteRule ^ - [E=SITE:P3Site]
RewriteRule ^ - [E=PARTNERNAME:Partner3]
...
RewriteCond %{HTTP_HOST} !XXXXXX [NC]
RewriteRule ^/$ /%{ENV:SITE}/ [NE,L,R=permanent]
RewriteRule ^/console/$ /console/login/%{ENV:PARTNERNAME} [NE,L,R=permanent]
RewriteRule ^/admin/$ /admin/login/%{ENV:PARTNERNAME} [NE,L,R=permanent]
ProxyPassInterpolateEnv On
ProxyPass /userLogs/ http://jboss.local/userLogs/${PARTNERNAME}/ interpolate
ProxyPassReverse /userLogs/ http://jboss.local/userLogs/${PARTNERNAME}/ interpolate
|
What I expect here is this
User go to https://partner_1.domain.com/console and he should be redirected to https://partner_1.domain.com/console/login/
User go to https://partner_3.domain.com/userLogs/ and he should see the content of http://jboss.local/userLogs/Partner3/
In short the only differences between all of our vhost are where you see the environment variable.
Is there any easy way to do this ? or should I keep creating virtual hosts as all individual files as currently?
Thanks |
|
Back to top |
|
|
|
|
|
|