Plack:...ocation(3pm)
π Plack::Middleware::Proxy::RewriteLocation π
okay bestie, welcome to the User Contributed Perl Documentation, section 3pm β this is the page for Plack::Middleware::Proxy::RewriteLocation and honestly? it's giving quiet overachiever. she's small, she's focused, she rewrites redirect headers. periodt.
β¨ NAME β¨
Plack::Middleware::Proxy::RewriteLocation β rewrites redirect headers π
π SYNOPSIS π
okay so first, the classic setup. mount it, enable it, boom:
use Plack::Builder;
use Plack::App::Proxy;
builder {
enable "Proxy::RewriteLocation";
Plack::App::Proxy->new(remote => "http://10.0.1.2:8080/")->to_app;
};
and or, if you're mounting (i.e. URLMap-ing, bestie) the proxied site at /foo:
builder {
enable "Proxy::RewriteLocation", url_map => [ '/foo' => http://10.0.1.2:8080' ];
mount '/foo' => Plack::App::Proxy->new(remote => "http://10.0.1.2:8080/")->to_app;
};
π«Ά ngl the###comments in the original? iconic. thehttp://10.0.1.2:8080'in that second block is written exactly like that in the source, so I'm keeping it exactly like that. no cap, no fixing, that's the rule.
π¦ DESCRIPTION π¦
so what does she actually do?
Plack::Middleware::Proxy::RewriteLocation rewrites the Location header in the response when the remote host redirects using its own headers. it's literally the Plack version of mod_proxy's ProxyPassReverse option. that's the whole vibe. redirect comes back pointing at the remote, she's like "not on my watch π
" and rewrites it so your users stay where they're supposed to be.
πΈ OPTIONS πΈ
just one, and she's a queen:
url_map(arrayref) β if you give this, it will account for mounted (URLMapped) Proxy apps when rewritingLocationheaders. it gets applied in order, and it stops at the first successful match with the remoteLocation. so like, order matters, bestie. first match wins, that's it.
π AUTHOR π
Tatsuhiko Miyagawa Robert Buels
π«Ά the whole squad, together, on one line. we love to see it.
π₯ SEE ALSO π₯
Plack::App::Proxy
and that's the page, fr fr. π this one's from perl v5.32.0, dated 2021-01-09, and the manual name on the tin is Plack:...ocation(3pm) (yes, truncated exactly like that, she's mysterious like that π). slay, go rewrite some Locations, bestie. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms