URL_LFS_REWRITE(8)
π URL_LFS_REWRITE(8) β bestie edition β¨
okay so this is url_lfs_rewrite, and she's a User Contributed Perl Documentation page, which means a real human Perl person wrote her for us π«Ά she's living her best life in section 8 of the manual, and by the end of this you two are gonna be so acquainted.
β¨ NAME β¨
url_lfs_rewrite β a URL-rewriter based on local file existence π
like, she rewrites URLs, but the whole vibe is "does this file actually exist on my disk?" no file, no rewrite. simple as that, no cap.
π¦ SYNOPSIS π¦
url_lfs_rewrite [--debug] --local-dir=/var/www/ [options]
that's the shape of her. --debug if you're nosy, --local-dir=/var/www/ is basically the main character argument, and then whatever [options] you feel like sprinkling on top πΈ
π DESCRIPTION π
So here's the β¨ concept β¨: she takes every incoming request and, if that requested file actually lives inside a local directory, she directs the whole thing over to a local web server that's hosting that directory. local file β local server. match made in heaven π«
And bestie, she's built different β this program uses Squid concurrency support π₯ she can juggle, she can multitask, she's got main character energy.
π OPTIONS π
--debugβ writes debug info tostderr. for when you simply must know what's going on inside her head π--local-dirβ the directory path under which the script goes searching for files. this is the one she cares about most, give her a good one π₯°--to-schemeβ the scheme to use for the redirected URL. Default:http--to-hostβ the domain name to use for the redirected URL. Default:localhost--to-pathβ a URL path to add as a prefix for the redirected URL path. If you set it, it must end with a/π Default: use the original URL path.
π KNOWN ISSUES π
listen, nobody's perfect, and she's got a few little quirks. not me exposing her like this but you need to know:
- The
--local-dirparameter must end with a'/'. Otherwise no file paths will be found. like, zero. none. she will simply not see them π - URLs with no filename in the path can match directories on the local filesystem and be wrongly redirected to the local web server. oops π
- Any scheme name accepted by the Perl URL library can be used as the
--to-schemeparameter. However only schemes supported by Squid will work. so like, the Perl library said yes but Squid said no π - URLs containing query-strings are not handled well and will not be rewritten even if the base script or file exists on the local system. yeah. she's not great with those. we don't talk about it π«
π CONFIGURATION π
here's the setup, copy-paste-able, exactly as written:
url_rewrite_program /path/to/url_lfs_rewrite --local-dir=\var\www\localhost
url_rewrite_children 20 startup=1 idle=1 concurrency=25
url_rewrite_access deny CONNECT
url_rewrite_access deny to_localhost
so β this helper can redirect to any web server, but she only actually does it if there's a file matching the URL path segment sitting in the local filesystem. normal configuration requires a web server running on localhost serving up files from a local disk (eg. \var\www\localhost). configuration of that web server is not covered here β that's a whole other episode, bestie π¬
π§ AUTHOR π§
This program and documentation was written by Amos Jeffries <squid3@treenet.co.nz> β icon, legend, the moment π
Based on prior work in rredir.pl by Peter Eisenhauer <pe@pipetronix.de>. First Version: 26. May 1997 β genuinely vintage, we stan a long-running project.
π COPYRIGHT π
* Copyright (C) 1996-2026 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
like, respect the license bestie, it's literally right there π«Ά
π REPORTING BUGS π
- Bug reports need to be made in English. See
https://wiki.squid-cache.org/SquidFaq/BugReportingfor details of what you need to include with your bug report. - Report bugs or bug fixes using
https://bugs.squid-cache.org/ - Report serious security bugs to Squid Bugs
<squid-bugs@lists.squid-cache.org> - Report ideas for new improvements to the Squid Developers mailing list
<squid-dev@lists.squid-cache.org>
fr fr, if it's a security thing, use the security address. don't just drop it in the public tracker, that's not the vibe π
π₯ SEE ALSO π₯
squid(8),GPL(7),- The Squid FAQ wiki
https://wiki.squid-cache.org/SquidFaq - The Squid Configuration Manual
http://www.squid-cache.org/Doc/config/
iykyk, go read the squid page next, she's the whole ecosystem πΈ
π and that's the page!! cute little sign-off for you: this one's shipped as part of perl v5.42.2, dated 2026-08-25 β so she's fresh, she's current, she's serving. periodt β¨ππ¦
π¦ where this page comes from
- arch rolling: squid 7.7-1 Β· GPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms