mod_reproxy is an Apache2 module that implements support for the X-Reproxy-Url header, as originally implemented in Danga Interactive's perlbal load balancer.
By setting the X-Reproxy-Url header, a backend process tells mod_reproxy to serve the response from another location, effectively letting the request redirect transparently (and within the same request). This can help to reduce load considerably.
Installation assumes you have Ruby and Rake installed. To install mod_reproxy:
$ rake all
This will build the module, install it, and restart apache. You can do each step separately if you wish:
$ rake
$ rake install
$ rake restart
If anyone is particularly offended by using Rake, you are encouraged to submit alternative build files (e.g. makefile, etc.).
By default, reproxying is disabled. However, you can enable it in <Directory>,
<Files>, and <Location> contexts with the AllowReproxy
setting:
<Location />
AllowReproxy on
</Location>
Reproxying will then be enabled within the context you specified.
If reproxying is enabled for a particular request (see "Enabling Reproxying", above), then mod_reproxy will set the X-Proxy-Capabilities header to "reproxy-file". A backend can then use that header to determine whether reproxying is allowed for the response.
If the backend determines that reproxying is supported, it may respond with an X-Reproxy-Url header that contains a space-delimited list of one or more URLs. The body of the response will be ignored in this case.
When mod_reproxy sees the X-Reproxy-Url header, it will sequentially try each of the provided URLs until one is successful. The response will then be the body of the reproxied response, with the original response body being discarded.
By default, the reproxied response will entirely replace the entire original
response, including the headers. However, using the PreserveHeaders
option
you can indicate which headers from the original response should be
preserved in the reproxied response. Typically, this will be things like
Content-Type
, Content-Disposition
, and so forth, allowing the backend
to set those for the reproxied response.
<Location />
AllowReproxy on
PreserveHeaders Content-Type Content-Disposition
</Location>
If you are interested in hacking on mod_reproxy, either to add new features, or to fix bugs, please make sure you have the latest version, found here:
Patches may be submitted via email (jamis@jamisbuck.org), or as github pull requests.
Likewise, suggestions for improvement or feature requests may be submitted via the issue tracker (see above link).
mod_reproxy is released under the terms of the MIT license. Please see the accompanying LICENSE file for the full text of the license.