Bug 41614

Summary: Certain types of encoding generate proxy errors
Product: Apache httpd-2 Reporter: Mark <mark>
Component: mod_proxy_balancerAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 2.2.3   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Mark 2007-02-14 12:26:32 UTC
We have Apache 2.2.3 using mod_proxy_balancer to send requests to a mongrel
backend cluster for rails apps. We have some mod rewrite in effect that help
sort what goes to the balancer and what gets served directly by apache. When
sending requests to the balancer for the rails app, sometimes Apache reports :

----
Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /articles/show/127129-Global
Conference? test? test.

Reason: Error reading from remote server
-----

"/articles/show/127129-Global Conference? test? test" is the actual URL. The
portion beyond 127129 is the title of the article. 

Mod_rewrite reports that it sends to the balancer this: 

"articles/show/127129-Global Conference" with args = "test? test" 

The actual encoding looks like this: 

http://server/articles/show/127129-Global+Conference%3f%20test%3ftest

Note here that the rails app only needs the portion up to 127129, the rest is
appended to the URL for search engine optimization purposes - so links on Web
pages contain a URL similar to the one above. 

Seems as though somewhere along the line mod_proxy_balancer doesn't like the
encoding. We can connect directly to the mongrel server using Lynx and pass the
URL and get a correct response. But going through Apache and the balancer we get
the error cited above.  

What we found in trying to debug this is that if the space char (%20) is removed
then the balancer will return the requested content (since the rails app doesn't
care much about what other chars are beyond the number in the URL).
Comment 1 Mark 2007-02-15 14:16:18 UTC
Here's another sample URL that results in "Not Found" from mongrel (serving the
Rails app with Apache as the reverse proxy frontend) which means that Apache
with mod_proxy_balancer somehow doesn't like the encoded forward slash char
(%2F). If we remove that / char (as encoded), the URL works fine. 
%
/articles/show/127139-Date+In+The+Title+-+Test+4%2F27

Actual URL looks like this

/articles/show/127139-Date+In+The+Title+-+Test+4/27
Comment 2 Mark 2007-02-15 14:30:25 UTC
Forgot to mention that in that last example with the forward slash encoded char,
Apache sends the request to mongrel, but it's returned as not found. However
using the encoded URL via wget directly to the mongrel server works fine.
Somewhere along the line Apache is messing up the request. 
Comment 3 Nick Kew 2007-09-08 17:57:08 UTC

*** This bug has been marked as a duplicate of 39746 ***