freaks out with normal URLs

Oh, the strange things mod_rewrite does!

freaks out with normal URLs

Postby carmen » Sun Jan 14, 2007 7:43 pm

all i want is to do the most basic of tasks - add a port number, to forward to a local proxy, and apache is choking on the incoming URLs..

the config is verbatim from several working rails setups on the same machine, but none of them have escaped stuff in their URLs, i guess.

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://site_cluster%{REQUEST_URI} [P,QSA,L]

merely requesting http://site/%f is enough to get a 400 Bad Request

i see various things about an unavoidable layer of unescaping - this sounds bad, and i cant think of any other explanations... i mean REQUEST_URI should mean REQUEST_URI, not "choke on REQUEST_URI if it contains certain chars", right?
carmen
 
Posts: 2
Joined: Mon Dec 18, 2006 8:16 pm

Postby richardk » Tue Jan 16, 2007 8:11 am

% is a special character (used for URL encoding) and should be encoded to %25. Does the server accept %f without the mod_rewrite, i wouldn't have thought mod_rewrite would send a 400 error.

i mean REQUEST_URI should mean REQUEST_URI, not "choke on REQUEST_URI if it contains certain chars", right?

I would have thought it would choke when it attempted to decode it, not when it used REQUEST_URI. Or after the new URL has been setup, and it tries to encode it.

Is it logged in the error log? Can you get a RewriteLog? You might be able to use mod_proxy instead (although i don't think you can ignore files with that).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby carmen » Wed Jan 17, 2007 11:38 pm

% is a special character (used for URL encoding)


right. the reason its in the URL is for that

You might be able to use mod_proxy instead (although i don't think you can ignore files with that).


had the same problem with proxypass actually. it was also unescaping the URLs. i'll install apache and see if i cant find a workaround and report back - the fact that both of these things actually modify the URL (or at least choke on it - hard to say) before the user explicitly tells it to do anything to it, bugs me..
carmen
 
Posts: 2
Joined: Mon Dec 18, 2006 8:16 pm

Postby richardk » Thu Jan 18, 2007 12:25 pm

http://issues.apache.org/bugzilla/show_bug.cgi?id=34602
http://issues.apache.org/bugzilla/show_bug.cgi?id=23295

You could try this:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteMap urlescape int:escape

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule . balancer://site_cluster${urlescape:%{REQUEST_URI}} [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 3 guests

cron