Bug 13577 - mod_proxy mangles query string with mod_rewrite
Summary: mod_proxy mangles query string with mod_rewrite
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.0.40
Hardware: All All
: P3 major with 2 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-13 05:36 UTC by Eugene Chupriyanov
Modified: 2005-10-07 07:36 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Chupriyanov 2002-10-13 05:36:53 UTC
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
Comment 1 Martin Wickman 2004-05-27 15:11:28 UTC
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
Comment 2 Martin Wickman 2004-05-27 15:33:54 UTC
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.
Comment 3 Nick Kew 2004-06-29 06:53:22 UTC
This may be fixed in HEAD by patch for bug 15207 (mod_proxy), but the
interaction with mod_rewrite is untested.  Please review.
Comment 4 Nick Kew 2004-09-12 16:08:35 UTC
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.
Comment 5 Adi 2005-05-20 18:01:10 UTC
(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.
Comment 6 Axel-Stephane Smorgrav 2005-10-07 15:30:35 UTC
(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.
Comment 7 Axel-Stephane Smorgrav 2005-10-07 15:36:07 UTC
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]