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' <[email protected]> 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 <[email protected]> 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
>> [email protected]
>> [email protected]
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: [email protected]
>> " from the digest: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
---------------------------------------------------------------------
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: [email protected]
" from the digest: [email protected]
For additional commands, e-mail: [email protected]