Should we be prepared to maintain this as a patch on the 0.8 stream, or
would some variation of this fix be folded into 0.8 (via some config
setting
or as the new behavior)?
And while we are at it, how stable is 0.8? I thought I had seen some
discussion of 0.8 being marked “stable” soon. Just curious.
On Fri, Jun 11, 2010 at 04:07:10PM -0400, Peter Portante wrote:
Hi Igor,
This is working great. Thank you!
Should we be prepared to maintain this as a patch on the 0.8 stream, or
would some variation of this fix be folded into 0.8 (via some config setting
or as the new behavior)?
And while we are at it, how stable is 0.8? I thought I had seen some
discussion of 0.8 being marked “stable” soon. Just curious.
Here is a new patch that encodes these spaces as %20 while talking
to a proxied backend. I’m going to commit the patch in next 0.8.41.
0.8 is stable, use it.
I’m tried both nginx 0.8.46 and 0.8.52 to reverse proxy a URI with a
whitespace, but I’m having no luck. Any URI without a space loads just
fine, but one that contains a white space results in a “Bad Request -
HTTP Error 400. The request is badly formed.” I verified that the
patch reference above was in 0.8.46. [The %20 substitution was missing
from the proxy module so I added it but it didn’t help.]
Are you folks about to reverse proxy a white space URI like
“Nginx Forum Images/test-image.jpg”
That’s not a valid URI. I just wanted to give an example that shows the
type of white space that is in my URI.
I have tried both nginx 0.8.46 and 0.8.52 to reverse proxy a URI that
contains a whitespace, but I’m having no luck. Any URI without a space
loads just fine, but one that contains a white space results in a “Bad
Request - HTTP Error 400. The request is badly formed.”
I had verified that the patch referenced above was in the source of
0.8.46. [The %20 substitution was missing from the proxy module so I
added it, but adding that substitution didn’t help.]
Are any of you folks able to reverse proxy a white space URI like
“Nginx Forum Images/test-image.jpg” That’s
not a valid URI. I just wanted to give an example that shows the type of
white space that is in my URI.
As I said, my patch modifies the behavior to accept single ‘%’
(percent) in the url, not spaces. But maybe you can take inspiration
from that and apply it to your own case.
I was in a similar situation trying to reverse proxy to a site that
has single percent signs in the url, which aren’t part of a url
encoding.
I did a quick patch to allow that, maybe this can help you.
from nginx.conf
upstream backendcms {
server 172.26.161.230;
}
from my location specific conf
location ~* ^/us(.*)? {
proxy_set_header Host xxx.xxx.xxx;
proxy_pass http://backendcms$1;
subs_filter …
}
It truly is the white-space causing the issue because I copied the
“Member Images” folder to “Member-Images”. Trying the URI with the
hypen works and with the %20 does not.
On Tue, Sep 28, 2010 at 01:06:36PM -0400, cgarver wrote:
proxy_pass http://backendcms$1;
subs_filter .....
}
It truly is the white-space causing the issue because I copied the
“Member Images” folder to “Member-Images”. Trying the URI with the
hypen works and with the %20 does not.
The 400 error is sent by backend because backend does not support
unencoded
spaces in URI. nginx can espace it, if you will use
Thanks, but when I try that I cannot get nginx to start.
/etc/init.d/nginx restart
[emerg]: “proxy_pass” may not have URI part in location given by regular
expression, or inside named location, or inside the “if” statement, or
inside the “limit_except” block in /etc/nginx/national_sites.conf:4
configuration file /etc/nginx/nginx.conf test failed
On Tue, Sep 28, 2010 at 01:24:25PM -0400, cgarver wrote:
Thanks, but when I try that I cannot get nginx to start.
/etc/init.d/nginx restart
[emerg]: “proxy_pass” may not have URI part in location given by regular
expression, or inside named location, or inside the “if” statement, or
inside the “limit_except” block in /etc/nginx/national_sites.conf:4
configuration file /etc/nginx/nginx.conf test failed
Sorry to be a pain, but I cannot claim success yet.
The good news - the image now appears.
The bad news - the /us/ is now case sensitive and the www.xxxx.xxx/us/
site never returns. It’s in some kind of loop. A page further down
like www.xxxx.xxx/us/some-directory/some-page will work.
The problem with the looping was that I needed to update my subs_filter
to eliminate the leading slash in pattern matches. So, it is now
working very well except it is case sensitive which is bound to cause
some issues. Is there a rewrite I can do to force the request to
lowercase without killing server performance?