Forum Moderators: phranque
[blah.com...]
Apache is handing this off to the mongrel cluster like:
[blah.com...]
however, I really want it to hand it off like:
[blah.com...] because the %3F is important and needs to be sent over.
Our current rewrite rules to the cluster are like:
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://blah_cluster%{REQUEST_URI} [P,QSA,L]
I've tried to modify these rules to pass along the %3F but nothing worked. Any ideas?
Another approach might be to use a RewriteCond to create back-references to THE_REQUEST for use in the RewriteRule. THE_REQUEST is the actual request header received from the client, and is not subject to any decoding or un-escaping as are REQUEST_URI and the URL-path examined by RewriteRule.
THE_REQUEST might look like this, for example:
GET /blah/monster_of_the_midway%3F HTTP/1.1
and might be handled with code like:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]*)\ HTTP/
RewriteCond %{DOCUMENT_ROOT}/%1 !-f
RewriteRule ^/(.*)$ balancer://blah_cluste[b]r/%1[/b] [P,QSA,L]
Be aware that you're fighting Apache's various mod_dir fix-up routines here. Apache is going to "want to correct" your URI to "http://www.blah.com/blah/monster_of_the_midway/?" -- Note the slash preceding the "?". As a result, my code snippet may not work, or it may only offer a partial solution and need to be modified.
Jim