You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris DiLorenzo <cd...@gmail.com> on 2012/06/08 04:47:58 UTC

[users@httpd] Problem matching with ProxyPassMatch

Hello,

I have the following ProxyPassDirective:

ProxyPassMatch ^/product/(detail.+bsins=20.*) balancer://product-gift/$1

The balancer is 2 app servers running an HTTP connector.  The Balancer
is configured properly.

When the server receives this request, or something similar:

http://<SERVER-NAME>/product/detail?bsins=2031000THANKU1859961

I get a 404 error.  I have checked the regex using an online checker
and it appears to be written properly.

Basically, I need to send requests for /product/detail?bsins=20* to a
specific load balancer and all other traffic to another one.  I feel
like I'm pretty close, but I can not get the above directive to work.
Is it the ? in the URL?

Thanks for the help,
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Problem matching with ProxyPassMatch

Posted by Daniel Ruggeri <DR...@primary.net>.
On 6/8/2012 5:35 PM, Daniel Ruggeri wrote:
> You can use mod_rewrite to take action based on URI and query string as
> well as proxy. This should work for you:
Sorry! Correction!

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/product/detail$
RewriteCond %{QUERY_STRING} ^(bsins=20.*)
RewriteRule .* balancer://product-gift/%1 [P,L]

-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Problem matching with ProxyPassMatch

Posted by Daniel Ruggeri <DR...@primary.net>.
On 6/7/2012 9:47 PM, Chris DiLorenzo wrote:
> Basically, I need to send requests for /product/detail?bsins=20* to a
> specific load balancer and all other traffic to another one.  I feel
> like I'm pretty close, but I can not get the above directive to work.
> Is it the ? in the URL?

I believe the problem is that ProxyPassMatch does not work on the query
string. I haven't tested to be sure, though.

You can use mod_rewrite to take action based on URI and query string as
well as proxy. This should work for you:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/product/detail$
RewriteCond %{QUERY_STRING} ^(bsins=20.*)
RewriteRule .* balancer://product-gift/%1

Note the %1 back reference instead of $1 - %X is for cond matches, $X is
for rule matches.

-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org