Plack::Hanlder::FCGI Bug?

26 views
Skip to first unread message

Josef Chladek

unread,
Oct 25, 2011, 9:25:23 AM10/25/11
to psgi-plack
Hi,

we run the latest of Catalyst (5.90005), have our app mounted under /
myapp attached to apache2 via fastcgi. The problem just occurred after
upgrading from the non-plack-catalyst (5.80027).

the problem now is, that rewrite rules (PassThrough) for apache result
in bad paths in catalyst. for example:

/foo has the rewrite rule in apache to /myapp/somecontroller/method

gets correctly rewritten in apache but gets transformed to /foo in
Plack/Handler/FCGI.pm. The reason for this are the lines around
linenumber 110:

# lighttpd munges multiple slashes in PATH_INFO into one. Try
recovering it
my $uri = URI->new("http://localhost" . $env->{REQUEST_URI});
$env->{PATH_INFO} = uri_unescape($uri->path);
$env->{PATH_INFO} =~ s/^\Q$env->{SCRIPT_NAME}\E//;

If I comment this block out, the correct PATH_INFO somecontroller/
method is called.
An if around this block
if ($env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ m!
lighttpd!)
would be the solution, I guess

thanks
josef

Tatsuhiko Miyagawa

unread,
Oct 25, 2011, 5:44:36 PM10/25/11
to psgi-...@googlegroups.com
Hi,

there's a related ticket on Apache2 handler as well:
https://github.com/miyagawa/Plack/issues/254

This is related to the whole "trust PATH_INFO from web server or
resurrect from REQUEST_URI" issue. In Plack, we try to resurrect the
correct PATH_INFO based on REQUEST_URI because most web servers
squeezes multiple slashes (//) into one slash.

In Catalyst, there's a config flag use_request_uri_for_path, which is
false by default, but if it's on, use the raw (undecoded) REQUEST_URI
for path, which is not exactly the same as what Plack does.

We will revert the PATH_INFO resurrection in Plack by default, and
include the middleware to do so - Catalyst can in turn resurrect the
PATH_INFO using undecoded REQUEST_URI in its
apply_default_middlewares.

--
Tatsuhiko Miyagawa

Reply all
Reply to author
Forward
0 new messages