Big picture
I believe the environment parameters REQUEST_URI and PATH_INFO are set incorrectly by nginx for apps that are not at the root ("/") endpoint. They currently include the endpoint path, but they should strip this out.
My specific issue
I'm trying to get my site running before Webfaction closes my account on 9 Dec :-)
I have a django site, served from a sub-folder of the domain (/resources):
When I go to a page on my site, I get a 404 like this:
Notice two things:
- Although the browser URL is /resources/talks, in the third line of the yellow box Django states that the URL is /resources/resources/talks (i.e. resources is repeated twice)
- The statement "The current path, resources/talks/, didn't match any of these" includes "resources".
I've repeated the above with and without django's FORCE_SCRIPT_NAME setting, but the result is the same.
If I get Django to throw an exception, and then look at the parameters passed to Django by Nginx, here are the relevant ones for the URL http://cornerstone.opalstacked.com/resources/:
HTTP_FORWARDED_REQUEST_URI '/resources/'
HTTP_HOST 'cornerstone.opalstacked.com'
HTTP_X_FORWARDED_HOST 'cornerstone.opalstacked.com'
HTTP_X_FORWARDED_PROTO 'http'
HTTP_X_FORWARDED_SERVER 'cornerstone.opalstacked.com'
HTTP_X_FORWARDED_SSL 'off'
PATH_INFO '/resources/'
REQUEST_URI '/resources/'
SCRIPT_NAME '/resources'
Based on error reports I got from Webfaction, I believe the REQUEST_URI and PATH_INFO should not contain /resources -- i.e. they should be just be '/' for this URL.