.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "URL_LFS_REWRITE 8" .TH URL_LFS_REWRITE 8 2024-04-09 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME .Vb 1 \& url_lfs_rewrite \- a URL\-rewriter based on local file existence .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& url_lfs_rewrite [\-\-debug] \-\-local\-dir=/var/www/ [options] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Direct all request to files who are in a local directory to a local web server hosting this directory. .PP This program uses Squid concurrency support. .SH OPTIONS .IX Header "OPTIONS" .IP \fB\-\-debug\fR 12 .IX Item "--debug" Write debug info to stderr. .IP \fB\-\-local\-dir\fR 12 .IX Item "--local-dir" Directory path under which the scripts searches for files. .IP \fB\-\-to\-scheme\fR 12 .IX Item "--to-scheme" Scheme to use for the redirected URL. .Sp .Vb 1 \& Default: http .Ve .IP \fB\-\-to\-host\fR 12 .IX Item "--to-host" Domain name to use for the redirected URL. .Sp .Vb 1 \& Default: localhost .Ve .IP \fB\-\-to\-path\fR 12 .IX Item "--to-path" URL path to add as prefix for the redirected URL path. .Sp If set it must end with a '/'. .Sp .Vb 1 \& Default: use the original URL path. .Ve .SH "KNOWN ISSUES" .IX Header "KNOWN ISSUES" * The \-\-local\-dir parameter must end with a '/'. Otherwise no file paths will be found. .PP * URL with no filename in the path can match directories on the local filesystem and be wrongly redirected to the local web server. .PP * Any scheme name accepted by the Perl URL library can be used as the \-\-to\-scheme parameter. However only schemes supported by Squid will work. .PP * URL containing query-string are not handled well and will not be rewritten even if the base script or file exists on the local system. .SH CONFIGURATION .IX Header "CONFIGURATION" .Vb 4 \& url_rewrite_program /path/to/url_lfs_rewrite \-\-local\-dir=\evar\ewww\elocalhost \& url_rewrite_children 20 startup=1 idle=1 concurrency=25 \& url_rewrite_access deny CONNECT \& url_rewrite_access deny to_localhost .Ve .PP This helper can redirect to any web server but only does so if there is a file matching the URL path segment in the local filesystem. Normal configuration requires a web server running on localhost serving up files from a local disk (eg. \evar\ewww\elocalhost). Configuration of that web server is not covered here. .SH AUTHOR .IX Header "AUTHOR" This program and documentation was written by \fIAmos Jeffries .PP Based on prior work in \fBrredir.pl\fR by \fIPeter Eisenhauer . First Version: 26. May 1997 .SH COPYRIGHT .IX Header "COPYRIGHT" .Vb 5 \& * Copyright (C) 1996\-2023 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. .Ve .SH "REPORTING BUGS" .IX Header "REPORTING BUGS" Bug reports need to be made in English. See https://wiki.squid\-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report. .PP Report bugs or bug fixes using https://bugs.squid\-cache.org/ .PP Report serious security bugs to \fISquid Bugs .PP Report ideas for new improvements to the \fISquid Developers mailing list .SH "SEE ALSO" .IX Header "SEE ALSO" squid (8), GPL (7), .PP The Squid FAQ wiki https://wiki.squid\-cache.org/SquidFaq .PP The Squid Configuration Manual http://www.squid\-cache.org/Doc/config/