Subject: | FastCGI Engine, Nginx uri/path problems when run remotely |
Hi - who knows with all the variations in documentation about what
should be done in Nginx configs, and the changes internally dealing with
uri_to...
But this happens when running Nginx on a remote server, accessing
Catalyst on another server being run via net socket FCGI (using
scripts/fastcgi.pl)
If Nginx sends SCRIPT_NAME, Catalyst uri_to paths are screwed up --
where the last controller/action bit gets duplicated on the end.
If Nginx sends PATH_INFO and no SCRIPT_NAME, then Catalyst makes good
uri_to stuff. However, it generates errors in the server logs that
FastCGI sends back in stderr:
Use of uninitialized value $script_name in regexp compilation at
/home/mark/perl5/lib/perl5/Catalyst/Engine/FastCGI.pm line 239
Of course, this or that thing to suck up the errors/warnings, when it's
working correctly...
But it can also be fixed by adding the following to
Catalyst/Engine/FastCGI.pm
237c237
< elsif ( $env->{SERVER_SOFTWARE} =~ /^nginx/ && $env->{SCRIPT_NAME} ) {
---
Show quoted text
> elsif ( $env->{SERVER_SOFTWARE} =~ /^nginx/ ) {
Well, you'd prolly want to put the simpler test first. I have no idea
how this effects other things you may have in mind - but this is for
you, from my insular little world, in case it might be good for you to know.