Chapter 9. Proxying

The mod_proxy module adds multiprotocol proxy server capabilities to Apache, allowing documents to be fetched from other servers, which may themselves be proxy servers. As of Apache 2.1, mod_proxy provides facilities for connection pooling, and, as of 2.2, for load balancing. Caching functionality was moved out of mod_proxy in Apache 2.0 and is now provided by mod_cache.

Support for individual protocols is implemented by separate provider modules, as listed in Table 9-1. Proxying of content over SSL/TLS connections requires the support of the mod_ssl module.

Table 9-1. Proxy support modules

Module

Protocols supported

mod_proxy_ajp

Apache JServ Protocol version 1.3 (AJP13)

mod_proxy_balancer

Pseudoprotocol used for load balancer groups

mod_proxy_connect

HTTP CONNECT, used to tunnel SSL/TLS requests

mod_proxy_ftp

FTP (supports only GET requests)

mod_proxy_http

HTTP and proxied FTP

Basic Proxy Configuration

A request is deemed to be a proxy request if the hostname in the URL is not one served by the server. Requests can also be rewritten to be proxy requests using the RewriteRule directives with the [P] flag.

A proxy server can operate in two modes: as a forward proxy, where it accepts requests for remote URLs and fetches those resources on behalf of clients; or as a reverse proxy, where requests for URLs on the proxy server are mapped to remote URLs, retrieved, and returned to the clients as if they originated from the proxy server itself.

mod_proxy recognizes a number of environment ...

Get Apache 2 Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.