Double query_string with [P]

Oh, the strange things mod_rewrite does!

Double query_string with [P]

Postby yelayon » Wed Jan 24, 2007 3:09 pm

Hello,

First of all - I dont want to use [R] in my rules.

What I try to achieve: every request /xxx to be served from localhost, and every request /yyy to be proxied to otherhost.

When I use: ProxyPass /xxx http://otherhost/xxx
Everything work fine. (perfect!!)

When I turn off ProxyPass and will use RewriteRule, like:
RewriteRule ^/xxx/(.*) http://otherhost/xxx/$1 [P]

Then every request like /xxx?foo=boo in access log on otherhost looks like:
GET /xxx%3Ffoo=boo?foo=boo

So QUERY_STRING is doubled by [P], and first occurence is URL-encoded, and second is normal.

Any idea?

Rgds, W.
yelayon
 
Posts: 3
Joined: Thu Nov 23, 2006 6:20 am

Postby richardk » Fri Jan 26, 2007 9:46 am

Try:
Code: Select all
RewriteRule ^/xxx(/.*)?$ http://otherhost%{REQUEST_URI} [P,L]


Or
Code: Select all
RewriteRule ^(/xxx/[^\?]*)?(\?.*)?$ http://otherhost$1 [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 1 guest

cron