Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (32 sloc) 1.16 KB
package Plack::Middleware::FixPathInfoMultipleSlashes;
use strict;
use parent 'Plack::Middleware';
use URI::Escape;
use URI;
sub call {
my($self, $env) = @_;
# lighttpd and apache munge 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//;
return $self->app->($env);
=head1 NAME
Plack::Middleware::FixPathInfoMultipleSlashes - fixes wrong PATH_INFO that lighttpd and apache generate by munging multiple slashes to one
# in your app.psgi
use Plack::Builder;
builder {
enable "FixPathInfoMultipleSlashes";
# Or from the command line
plackup -s FCGI -e 'enable "FixPathInfoMultipleSlashes"' /path/to/app.psgi
This middleware fixes wrong C<PATH_INFO> set by lighttpd and apache which munge multiple slashes to a single slash.
This middleware is not applied automatically, as it can break use of mod_rewrite when prepending things to the C<PATH_INFO>.
=head1 AUTHORS
Tomas Doran, Tatsuhiko Miyagawa, cho45
Jump to Line
Something went wrong with that request. Please try again.