Rechercher une page de manuel
Apache::ProxyRewrite.3pm
Langue: en
Version: 2008-03-11 (mandriva - 01/05/08)
Section: 3 (Bibliothèques de fonctions)
NAME
Apache::ProxyRewrite - mod_perl URL-rewriting proxySYNOPSIS
<Location /> SetHandler perl-script PerlHandler Apache::ProxyRewrite PerlSetVar ProxyTo http://www.tivoli.com PerlSetVar ProxyAuthInfo "BASIC aGb2c3ewenQ6amF4szzmY3b=" PerlSetVar ProxyAuthRedirect On PerlSetVar ProxyRewrite "https://www.tivoli.com/secure => /secure" </Location> <Location /secure> SetHandler perl-script PerlHandler Apache::ProxyRewrite PerlSetVar ProxyTo https://www.tivoli.com/secure PerlSetVar ProxyAuthInfo "BASIC aGb2c3ewenQ6amF4szzmY3b=" PerlSetVar ProxyAuthRedirect Off PerlSetVar ProxyRewrite "http://www.tivoli.com/ => /" PerlSetVar LocalError 1 </Location>
Called from another mod_perl handler :
Apache::ProxyRewrite($r, {
'ProxyTo' => 'https://www.tivoli.com/secure',
'ProxyAuthInfo' => 'BASIC aGb2c3ewenQ6amF4szzmY3b=',
'ProxyAuthRedirect' => 'Off',
'ProxyRewrite' =>
{ 'http://www.tivoli.com/' => '/' },
'LocalError' => 1,
'NoHeaders' => 1
'uri' => 'blah/blah.html',
'location' => '/blah/',
'hostinfo' => 'www.blah.com',
'scheme' => 'https'
}
); =head1 DESCRIPTION
Apache::ProxyRewrite acts as a reverse-proxy that will rewrite URLs embedded in HTML documents per apache configuration directives.
This module was written to allow multiple backend services with discrete URLs to be presented as one service and to allow the proxy to do authentication on the client's behalf.
CONFIGURATION OPTIONS
The following variables can be defined within the configration of Directory, Location, or Files blocks.- ProxyTo
- The URL for which ProxyRewrite will proxy its requests.
- ProxyAuthInfo
- Authorization information for proxied requests. This string must conform to the credentials string defined in section 11 of RFC 2068.
- ProxyAuthRedirect
- If the credentials supplied in the ProxyAuthInfo directive are insufficient and if ProxyAuthRedirect is set to On, the proxy server will redirect the client directly to the backend host. If ProxyAuthRedirect is set to Off (the default), the proxy server will challenge the client on the remote server's behalf.
- ProxyRewrite
- A hash of URLs to rewrite. A note on hashes in configuration directives from the ``Writing Apache Modules with Perl and C'' book page 287:
The only trick is to remember to put double quotes around the configuration value if it contains whitespace and not to allow your text editor to wrap it to another line. You can use backslash as a continuation character if you find long lines a pain to read.
- LocalError
- Boolean value that controls if the error message for a 404 is passed through from the proxy, or if the local server's message is used.
- NoHeaders
- Boolean. For use when chaining this module with other mod_perl handlers, this will disable the sending of the headers. Someone has to call $r->send_http_header() some time.
Source URL Overrides
These overrides let Apache::ProxyRewrite use supplied values, usually passed from another handler, instead of fetching the values from Apache.
- uri
- This is the URL of the request, minus the arguments.
"/proxied_dir/page.html"
- location
- This is the root of the proxied service.
"/proxied_dir"
- hostinfo
- The full host name (with optional port)
"www.tivoli.com"
- scheme
- http, https, ftp, gopher ...
NOTES
- Automatic mappings
- ProxyRewrite automatically adds a mapping for the remote relative URI and the current location. An example:
ServerName proxyhost <Location /foo> PerlSetVar ProxyTo http://server1/A </Location>
The request for http://proxyhost/foo/B is proxied to http://server1/A/B. Within the response from server1 is an embedded URI /A/C. This URI is rewritten to /foo/C before being returned to the client.
- Embedded Languages
- Embedded languages such as Javascript are not parsed for embedded URLs. The problem is NP-Complete. The best choice is to surround all embedded languages in HTML comments to avoid possible parsing problems.
- Parser Notes
- The parser takes a single pass through each HTML document. This method is extremely efficient, but it has possible drawbacks with poorly constructed HTML. All known drawbacks have been eliminated, but more may exist. Please contact the author if you have any trouble with parsed output.
- Special Thanks
- A special thanks goes to my co-authors of absent, from which much of the rewriting code comes, Dave Korman and Avi Rubin. Absent is a system for secure remote access to an organization's internal web from outside its firewall. To learn more about absent, go to http://www.research.att.com/projects/absent/.
AVAILABILITY
This module is available via CPAN at http://www.cpan.org/modules/by-authors/id/C/CG/CGILMORE/.AUTHOR
Christian Gilmore <cag@us.ibm.com>SEE ALSO
httpd(8), mod_perl(1)COPYRIGHT
Copyright (C) 2002, International Business Machines Corporation and others. All Rights Reserved.This module is free software; you can redistribute it and/or modify it under the terms of the IBM Public License.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre