httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Schrauwen <jorge.schrau...@gmail.com>
Subject Re: [users@httpd] Smarter rewrite rule
Date Fri, 23 Sep 2011 05:54:04 GMT
Alternatively you can also use mod_macro
(http://www.cri.ensmp.fr/~coelho/mod_macro/)
Personally I'm quite fond of this little module!

<Macro AppProxy $path $backend>
     ProxyPass $path/ $backend
     ProxyPassReverse $path/ $backend
     RewriteRule ^$path$ /$path/ [R]
</Macro>

AppProxy /pippo http://192.168.1.1/
AppProxy /pluto http://192.168.1.2/
AppProxy /paperino http://192.168.1.3/

~Jorge


On Thu, Sep 22, 2011 at 5:30 PM, Michele Mase' <michele.mase@gmail.com> wrote:
>
> So if app1 app2 and appn are pippo pluto paperino, the rules will be:
>
> ProxyPassMatch /(pippo|pluto|paperino) http://192.168.1.1/$1
> RewriteRule ^/(pippo|pluto|paperino)$ /$1/ [R]
> ProxyPassReverse / http://192.168.1.1/
>
> Correct?
>
> On Thu, Sep 22, 2011 at 12:41 PM, Rich Bowen <rbowen@rcbowen.com> wrote:
>>
>> On Sep 22, 2011, at 2:23 AM, Michele Mase' wrote:
>>
>> > Hi folks, I'using a lazy rule on my site:
>> > ...
>> > ProxyPass /app1/ http://192.168.1.1/app1/
>> > ProxyPassReverse /app1/ http://192.168.1.1/app1/
>> > RewriteRule ^/app1$ /app1/ [R]
>> > ProxyPass /app2/ http://192.168.1.1/app2/
>> > ProxyPassReverse /app2/ http://192.168.1.1/app2/
>> > RewriteRule ^/app2$ /app2/ [R]
>> > ....
>> > ProxyPass /appn/ http://192.168.1.1/appn/
>> > ProxyPassReverse /appn/ http://192.168.1.1/appn/
>> > RewriteRule ^/appn$ /appn/ [R]
>> > ...
>> > The list is from app1 till app60
>> >
>> > I have almost 60 rules and the conf file becomes difficult to read and edit
(error prone)
>> > How could I use a smarter one?
>>
>> ProxyPassMatch /app(\d+) http://192.168.1.1/app$1
>> RewriteRule ^/app(\d+)$ /app$1/ [R]
>> ProxyPassReverse / http://192.168.1.1/
>>
>> That'll do all 180 rules you have above.
>>
>> --
>> Rich Bowen
>> rbowen@rcbowen.com
>> rbowen@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
>>
>

---------------------------------------------------------------------
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


Mime
View raw message