You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Julien Cigar <jc...@ulb.ac.be> on 2010/04/22 11:56:14 UTC
[users@httpd] RedirectMatch and ProxyPass
Hello,
I have the following virtual host configuration :
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<VirtualHost *:80>
ServerName www.foo.be
ServerAlias www.fooa.be www.foob.be www.foobar.be
DocumentRoot /usr/local/www/apache22/www/www.foo.be/amnesia/public
RedirectMatch permanent ^/bbpf(.*) http://www.foo.be$1
RedirectMatch permanent ^/biotraining(.*) http://www.foo.be/602
RedirectMatch permanent ^/(ext/)?changes?(.*) http://www.foo.be/25
RedirectMatch permanent ^/invasions(.*) http://bar.foo.be
<Directory /usr/local/www/apache22/www/www.foo.be/amnesia/public>
Order allow,deny
Allow from all
</Directory>
##############
# Biodiversa #
##############
ProxyPass /biodiversa ajp://127.0.0.1:8009/biodiversa retry=20
ProxyPassReverse /biodiversa ajp://127.0.0.1:8009/biodiversa
###############
# Main portal #
###############
ProxyPassMatch /(files|images|js|styles) !
ProxyPass / http://127.0.0.1:5006/ retry=10
ProxyPassReverse / http://127.0.0.1:5006/
</VirtualHost>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The problem I have is that the RedirectMatch directives don't work,
unless I add them in my "ProxyPassMatch ... !" directive (which is a bit
boring, because I have to copy/paste every RedirectMatch pattern).
It seems that the request goes first through mod_proxy and then only
through mod_alias, event it the mod_alias directives (RedirectMatch)
appear first ... is it a normal behavior ?
Is there a clean way to do what I want to do, without involving
mod_rewrite if possible ?
Thanks,
Julien
--
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.
Re: [users@httpd] RedirectMatch and ProxyPass
Posted by Tom Evans <te...@googlemail.com>.
On Thu, Apr 22, 2010 at 12:55 PM, Eric Covener <co...@gmail.com> wrote:
>> It seems that the request goes first through mod_proxy and then only through
>> mod_alias, event it the mod_alias directives (RedirectMatch) appear first
>> ... is it a normal behavior ?
>
> It's normal, and the precedence the modules are coded for.
>
>> Is there a clean way to do what I want to do, without involving mod_rewrite
>> if possible ?
>
> Make your ProxyPassMatch more conservative with what it matches, or
> use Rewrite exclusively for the proxy and redirect so you have control
> on the order of evaluation (top-to-bottom in each config section when
> it's all RewriteRule)
>
Or use ProxyPass ! /path to preclude mod_proxy from proxying those
requests. They will then fall through to the mod_alias directives and
it will work as you expect.
Cheers
Tom
---------------------------------------------------------------------
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] RedirectMatch and ProxyPass
Posted by Eric Covener <co...@gmail.com>.
> It seems that the request goes first through mod_proxy and then only through
> mod_alias, event it the mod_alias directives (RedirectMatch) appear first
> ... is it a normal behavior ?
It's normal, and the precedence the modules are coded for.
> Is there a clean way to do what I want to do, without involving mod_rewrite
> if possible ?
Make your ProxyPassMatch more conservative with what it matches, or
use Rewrite exclusively for the proxy and redirect so you have control
on the order of evaluation (top-to-bottom in each config section when
it's all RewriteRule)
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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