when I redirect part of the site using RewriteRule [P] query strings get mangled. i.e. mod_proxy gets proxy:http://someotherhost/somepath/aaa.cgi?xxx=yyy but really it connects to someotherhost and sends: GET http://someotherhost/somepath/aaa.cgi%3Fxxx=yyy?xxx=yyy
Verified this for apache 2.0.40 on linux as well Detailed information about this bug here: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&th=6c79a3ed007af58b&rnum=1
Steps to reproduce: 1. Add RewriteRule ^dir/.*$ http://acme/dir2/?foo=bar [QSA,P] 2. $ curl 'http://proxy/dir/?abcd=efgh' 3. Check access_log on acme: GET /dir2/%3Ffoo=bar&abcd=efgh?foo=bar&abcd=efgh Changing to redirect [R] instead of [P] works just fine: $ curl -D - 'http://proxy/dir/?abcd=efgh'| grep Location: Location: http://acme/dir2/?foo=bar&abcd=efgh Which points to a bug in mod_proxy and not mod_rewrite.
This may be fixed in HEAD by patch for bug 15207 (mod_proxy), but the interaction with mod_rewrite is untested. Please review.
Can someone who runs rewrite+proxy please test this against my June 29th mod_proxy updates (from CVS), which fixes similar-looking bugs in the absence of mod_rewrite? If noone is taking an interest I'll assume it's fixed.
(In reply to comment #4) > Can someone who runs rewrite+proxy please test this against my June 29th > mod_proxy updates (from CVS), which fixes similar-looking bugs in the absence of > mod_rewrite? If noone is taking an interest I'll assume it's fixed. This bug is still present in Apache/2.0.54 so I'm assuming it is not fixed.
(In reply to comment #4) > Can someone who runs rewrite+proxy please test this against my June 29th > mod_proxy updates (from CVS), which fixes similar-looking bugs in the absence of > mod_rewrite? If noone is taking an interest I'll assume it's fixed. I made the following test on Apache 2.0.54: RewriteMap encode int:escape RewriteRule ^/folder/([^/]*)/([^/]*) /cgi-bin/printenv?vara=${encode:$1}&varb=$2 [PT,QSA] "GET /folder/apples&oranges/more?varc=rock%26roll" yields the following output: QUERY_STRING="vara=apples%26oranges&varb=more&varc=rock%26roll" REQUEST_URI="/folder/apples&oranges/more?varc=rock%26roll" I therefore believe the problem originally described no longer exists.
Previous comment contained a cut&paste error in the config. Correct configuration was: RewriteMap encode prg:/u01/apachetest/conf/encode.pl RewriteRule ^/folder/([^/]*)/([^/]*) http://labelle16:8080/cgi-bin/printenv?v ara=${encode:$1}&varb=$2 [P,QSA]