nginx: How to keep double slashes in urls
I had a similar issue with nginx+passenger (for Ruby on Rails / Rack / etc.), and I confirm that by default, multiple slashes are collapsed (in both PATH_INFO
and REQUEST_URI
).
Adding merge_slashes off;
in the server
context of the nginx configuration fixed it (I now see multiple slashes alright).
Also, make sure you don't have a trailing slash in the proxy_pass line!
GOOD:
proxy_pass http://localhost:3000
;BAD:
proxy_pass http://localhost:3000/
;
syntax: merge_slashes [on|off]
default: merge_slashes on
context: http, server
You must use: merge_slashes off
;