Plack::...NameFix(3)
π NAME π
okay bestie, gather round: this is the Plack::...NameFix(3) page, and it's all about Plack::Middleware::LighttpdScriptNameFix β the middleware that fixes the wrong SCRIPT_NAME and PATH_INFO that lighttpd sets π«Ά
β¨ SYNOPSIS β¨
drop it into your app like this:
# in your app.psgi
use Plack::Builder;
builder {
enable "LighttpdScriptNameFix";
$app;
};
or if you're a command-line girlie, do it like this instead:
# Or from the command line
plackup -s FCGI -e 'enable "LighttpdScriptNameFix"' /path/to/app.psgi
πΈ DESCRIPTION πΈ
so here's the tea π β lighttpd be out here setting SCRIPT_NAME and PATH_INFO all wrong when you mount your app under the root path ("/"). this middleware swoops in and fixes it, iconic behavior honestly.
but wait β if you're on lighttpd 1.4.23 or later, you don't even need this middleware, because you can just enable the fix-root-scriptname flag inside fastcgi.server instead. slay, options π
π CONFIGURATION π
π script_name
ngl, even with fix-root-scriptname, lighttpd still goes ahead and sets weird SCRIPT_NAME and PATH_INFO if you mount your application at "" or at something that ends with "/". so rude of it π
setting the script_name option tells the middleware how to reconstruct the new correct SCRIPT_NAME and PATH_INFO. basically you're handing it the map πΊοΈ
if you mount the app under "/something/", you should set:
enable "LighttpdScriptNameFix", script_name => "/something";
and then when a request for "/something/a/b?param=1" comes rolling in, SCRIPT_NAME becomes "/something" and PATH_INFO becomes "/a/b". no cap, that's the glow-up β¨
the script_name option is set to empty by default, which means all the request path gets set to PATH_INFO, and it behaves like your fastcgi application is mounted in the root path. periodt π«
π AUTHORS π
- Yury Zavarin
- Tatsuhiko Miyagawa
absolute legends, fr fr π«‘
π SEE ALSO π
Plack::Handler::FCGI<http://github.com/plack/Plack/issues#issue/68>- <https://redmine.lighttpd.net/issues/729>
lowkey a warning that's just a vibe check: the weird""/ trailing-"/"mount behavior is real, and the default emptyscript_namereally does mean everything lands inPATH_INFOlike your app lives at the root. don't @ me, that's just what the docs say π§
and that's the whole page babes π this one shipped as perl v5.42.3 on 2026-10-18 β go forth and fix those script names, main character energy only π₯
π¦ where this page comes from
- fedora 43: perl-Plack 1.0055-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Plack 1.0055-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms