Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx PATH_INFO issue - leading / missing #281

Open
bobtfish opened this issue Apr 20, 2012 · 3 comments
Open

nginx PATH_INFO issue - leading / missing #281

bobtfish opened this issue Apr 20, 2012 · 3 comments
Labels

Comments

@bobtfish
Copy link
Member

From the PSGI spec: PATH_INFO If this key is not empty, it MUST start with a forward slash (/).

I'm seeing PATH_INFO like 'public' instead of '/public', with nginx 0.7.59

This happens with BOTH of:
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param PATH_INFO /$fastcgi_script_name;

In my nginx config. And so appears to be something I can't control / fix.

Should there be a middleware to detect/correct this for specific nginx releases (I don't know which ones yet...), or is it a generic enough fix (just prepending the slash if not present and non-empty) to just add to the FCGI handler?

Thoughts welcome about the best way to fix this - I'm happy to work up test cases and a patch once I've got your opinion about where would be best to patch.

@bobtfish
Copy link
Member Author

For reference, I've applied this middleware locally in the app which was causing my troubles:

https://gist.github.com/2429475

and the problem I had (URLMap not matching) is fixed, as would be expected.

@miyagawa
Copy link
Member

Can you try with other, possibly newer versions of nginx to see if it's related?

@miyagawa
Copy link
Member

Here's the relevant snippet from the docs: note that none of them uses nginx-provided FCGI params for script_name or path_info since it's known to be incorrect.

      location / {
        set $script "";
        set $path_info $uri;
        fastcgi_pass unix:/tmp/fastcgi.sock;
        fastcgi_param  SCRIPT_NAME      $script;
        fastcgi_param  PATH_INFO        $path_info;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants