Module mod_proxy

Module mod_proxy supports directives for the IBM® HTTP Server for i Web server.

Summary

Directives for forward proxy function are as follows:

  • Required: ProxyRequests
  • Optional: AllowCONNECT, ProxyBlock, ProxyDomain, ProxyReceiveBufferSize, ProxyVia

Directives for reverse proxy function are as follows:

  • Required: ProxyPass
  • Optional: ProxyBlock, ProxyPassReverse, ProxyReceiveBufferSize, ProxyVia

Directives for proxy chaining function are as follows:

  • Required: ProxyRemote
  • Optional: NoProxy, (see forward or reverse proxy, above, for additional directives).

For a detailed description of these proxy functions and how they may be used, see Proxy server types and uses for HTTP Server.

Note: The mod_proxy directives require the following LoadModules in HTTP Server configuration file:
  • LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
  • LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
  • LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
  • LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM

Directives

BalancerInherit

Module: mod_proxy
Syntax: BalancerInherit on | off
Default: BalancerInherit On
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: BalancerInherit off

The BalancerInherit directive will cause the current server/virtual host to "inherit" ProxyPass Balancers and Workers defined in the main server.

Note: This can cause issues and inconsistent behavior if using the Balancer Manager and so should be disabled if using that feature.

The setting in the global server defines the default for all virtual hosts

BalancerMember

Module: mod_proxy
Syntax: BalancerMember [balancerurl] url [key=value [key=value ...]]
Default: none
Context: directory.
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example 1
ProxyPass /special-area http://special.example.com/ smax=5 max=10
ProxyPass / balancer://mycluster stickysession=jsessionid nofailover
<Proxy balancer://mycluster>
BalancerMember http://1.2.3.4:8009
BalancerMember http://1.2.3.5:8009 smax=10
# Less powerful server, don't send as many requests there
BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20
</Proxy>
Example 2
<Proxy balancer://mycluster2>
BalancerMember http://196.128.0.1:4000 
BalancerMember http://196.128.0.1:4001
</Proxy>
Then you proxy the location or virtual host to the cluster:
<VirtualHost *:80>
ProxyPass / balancer://mycluster2/
ProxyPassReverse / balancer://mycluster2/
</VirtualHost>
Note: The slash much occur after the ProxyPass directive.

The BalancerMember directive adds a member to a load balancing group. It can be used within a <Proxy balancer://...> container directive and can take any of the key value pair parameters available to ProxyPass directives.

One additional parameter is available only to BalancerMember directives: loadfactor. This is the member load factor - a number between 1 (default) and 100, which defines the weighted load to be applied to the member in question.

The balancerurl is only needed when not within a <Proxy balancer://...> container directive. It corresponds to the url of a balancer defined in ProxyPass directive.

The path component of the balancer URL in any <Proxy balancer://...> container directive is ignored.

Trailing slashes should typically be removed from the URL of a BalancerMember.

NoProxy

Module: mod_proxy
Syntax: NoProxy domain | subnet | ipaddr | hostname [domain | subnet | ipaddr | hostname ...]
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: NoProxy .mycompany.com 192.168.112.0/21

The NoProxy directive specifies a list of domains, subnets, IP addresses, and/or hosts (in any combination) separated by spaces. Multiple NoProxy directives are allowed. Items in each list are used to match requests for which the server should attempt to handle directly rather than going through a remote proxy server (specified using the ProxyRemote directive). When a client sends a request that matches one or more listed items, the server attempts to connect directly to the server specified in the URL rather than to a remote proxy (specified by ProxyRemote) to chain the request.

Parameter: domain | subnet | ipaddr | hostname
  • A domain is a partially qualified DNS domain name, preceded by a period. It represents a group of hosts that logically belong to the same DNS domain or zone (that is, the suffixes of the hostnames are all ending in Domain).
  • A subnet is a partially qualified Internet address in a numeric (dotted quad) form, optionally followed by a slash (/) and the netmask, specified as the number of significant bits in the subnet. It is used to represent a subnet of hosts that can be reached over a common network interface. In the absence of the explicit netmask it is assumed that omitted (or zero valued) trailing digits specify the mask. In this case, the netmask can only be multiples of '8 bits' wide. For example, the subnet '192.168.0.0' with an implied netmask of '16' valid bits (sometimes used in the netmask form 255.255.0.0.).
  • An ipaddr represents a fully qualified Internet address in numeric (dotted quad) form. Usually this address represents a host, but there need not necessarily be a DNS domain name connected with the address. For example: 192.168.123.7
  • A hostname is a fully qualified DNS domain name that can be resolved to one or more IP addresses via the DNS domain name service. It represents a logical host (in contrast to domain, see above) and must be resolvable to at least one ipaddr (or often to a list of hosts with different IP addresses).
Example
ProxyRemote * http://firewall.mycompany.com:81
NoProxy .mycompany.com 192.168.112.0/21
  • ProxyBlock may be used to block incoming requests prior to consideration for this directive.
  • This directive is commonly used in conjunction with the ProxyRemote and ProxyDomain directives for directing proxy requests within intranets.
  • Setting ProxyNoConnect to on negates this directive.

This directive may be configured multiple times in a container. The directives are processed from the first to the last occurrence.

Note: Hostname and domain name comparisons are done without regard to the case, and are always assumed to be anchored in the root of the DNS tree.

<Proxy>

Module: mod_proxy
Syntax: <Proxy criteria> ... </Proxy>
Default: none
Context: server config, virtual host, Not in Limit
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: Forward proxy
<Proxy http://www.ibm.com/>
  Require all granted
</Proxy>
Example: Reverse proxy
<Proxy /docs/>
  Require all granted
</Proxy>

The <Proxy> and </Proxy> directives are used to enclose (or contain) a group of directives that apply only to proxy requests that match the specified criteria. Multiple proxy containers are allowed, however they may not be nested. Requests that do not match container criteria are outside the context of the enclosed directives. Any directive allowed within a directory context is also allowed within a proxy context (see <Directory> for details on directory containers).

Parameter: criteria
  • The criteria parameter accepts a partial URL or virtual directory path used to identify requests to which the enclosed directives apply. Partial URLs are used to identify both forward and reverse proxy requests. A match is considered by comparing request URL strings to the specified criteria string, starting with the first character. A match is made if the two strings are identical, up to the length of the criteria string.

    Refer to <ProxyMatch> for details regarding the use of regular expression criteria for proxy containers.

    Directives within proxy containers apply only to matched requests handled by the proxy function (including both forward and reverse proxy). Requests not handled by the proxy function are not affected by directives within proxy containers.

Example One
<Proxy /user/local/httpd/htdocs>
 Require all granted
</Proxy>
Note: Previously, directory containers were used to enclose groups of directives that applied to proxy requests by appending the prefix "proxy:" to the beginning of the directory name criteria specified for <Directory> or <DirectoryMatch> directives. This is no longer supported. The proxy function now ignores directives enclosed in <Directory> (or <File>) containers.

Directives within <Location> containers (if matched) take precedence over directives within <Proxy> containers. See <Location> or <LocationMatch> for more information on <Location> containers.

When request URLs match criteria strings of multiple proxy containers, directives within all matched containers are combined and applied. <Proxy> sections are processed in the order they appear in the configuration file. The following is an example of how directives are combined and applied according to order.

Example Two: Forward Proxy
ProxyRequest on
<Proxy http://>
 Require all denied
 ServerSignature on
</Proxy>
<Proxy http://www.ibm.com/>
 Require all granted
</Proxy>

For this example, a request for http://www.ibm.com/docs/whitepaper.pdf matches criteria specified for both proxy containers, therefore the server applies the directives within both containers. Since the criteria specified for the second container (<Proxy http://www.ibm.com/>) is more specific (a better match) than the criteria specified for the first container (<Proxy http://>) directives enclosed within the second container take precedence. The request is therefore allowed since the second container has an "Require all granted" directive. The ServerSignature directive would be applied to this request as well (if needed). A request for http://web.samples.org/welcome.htm, however, only matches the criteria for the first container, and is therefore denied since this container has a "Require all denied" directive.

If request URLs match criteria strings for one or more <Proxy> directives as well as regular expression criteria for one or more <ProxyMatch> directives, the server applies matched <Proxy> and <ProxyMatch> container directives in the order they appear in the configuration file.

Example:
ProxyRequest on
<Proxy http://www.ibm.com/>
  Require all granted
</Proxy>
<ProxyMatch ^(.*)>
  Require all denied
</ProxyMatch>

A request for http://www.ibm.com/welcome.html matches criteria specified for both proxy containers, therefore the server applies the directives within both containers. Directives for the <Proxy> container are applied first, then directives for the <ProxyMatch> container. Due to the order that directives are applied, the request is denied since the "Require all denied" directive (from the <ProxyMatch> container) is applied last, eveh though the <Proxy> container is a more exact match.

Note: Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.

ProxyAddHeaders

Module: mod_proxy
Syntax: ProxyAddHeaders Off|On
Default: ProxyAddHeaders On
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyAddHeaders Off

The ProxyAddHeaders directive determines whether or not proxy related information should be passed to the backend server through X-Forwarded-For, X-Forwarded-Hostand X-Forwarded-Server HTTP headers.

Note: It only takes effect in HTTP proxying handled by mod_proxy_http.

ProxyBadHeader

Module: mod_proxy
Syntax: ProxyBadHeader IsError | Ignore | StartBody
Default: ProxyBadHeader IsError
Context: server, virtual host
Override: none
Origin: Apache
Example: ProxyBadHeader Ignore

This directive tells the server how to handle a bad header line in a response. The value ignore means the proxy ignores the bad header and continues. The value IsError means that the proxy fails out on the request. The value StartBody means that proxy (if it has seen other headers before this bad one) starts sending the rest of the headers as body and hopes that the server can handle it.

ProxyBlock

Module: mod_proxy
Syntax: ProxyBlock word | host | domain [word | host | domain ...]
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyBlock somecompany.com www-1.ibm.com www-2.ibm.com

The ProxyBlock directive specifies a list of words, hosts, and/or domains (in any combination), separated by spaces. Multiple ProxyBlock directives are allowed. Requests to sites whose URLs contain matched words, hosts, or domains are blocked by the server. At startup the server attempts to determine list item IP addresses, that may be host names, and records them for a match test.

Parameter: word | host | domain
  • A word can be any keyword (for example, ProxyBlock hello server good-bye).
  • A host is a fully qualified DNS domain name that can be resolved to one or more IP addresses via the DNS domain name service. It represents a logical host (in contrast to domain, see below) and must be resolvable to at least one IP address (or often to a list of hosts with different IP addresses), otherwise it is simply treated as a word (see above).
  • A domain is a partially qualified DNS domain name, preceded by a period. It represents a group of hosts that logically belong to the same DNS domain or zone (that is, the suffixes of the hostnames are all ending in Domain).
Example
ProxyBlock ibm.com www-1.ibm.com www-2.ibm.com server hello

The 'www-2.ibm.com' would also be matched if referenced by IP address since the server records addresses at startup for a match test. Note that either 'ibm.com' or 'ibm' is sufficient to match both 'www-1.ibm.com' and 'www-2.ibm.com' by word. However, their corresponding IP addresses would not be blocked since the server could not determine their addresses without having their hostnames specifically listed.

Note: " ProxyBlock *" effectively blocks requests to all sites and therefore should be avoided.

ProxyCacheOnly

Module: mod_proxy
Syntax: ProxyCacheOnly word | host | domain [word | host | domain ...]
Default: none (meaning cache all documents satisfying other caching directives)
Context: server config, virtual host
Override: none (meaning cache all documents satisfying other caching directives)
Origin: IBM
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyCacheOnly ibm.com® www-1.ibm.com www-2.ibm.com

The ProxyCacheOnly directive specifies a list of words, hosts, and domains (in any combination), separated by spaces. Multiple ProxyCacheOnly directives are allowed. Listed items are used to match requests for which the server should cache documents if caching is enabled. The server may then serve cached documents for subsequent requests. The server will also attempt to determine list item IP addresses and records them for a match test.

If this directive is absent, all documents satisfying all other caching directives (for example, ProxyNoCache, CacheMaxFileSize, CacheMinFileSize, etc.) are cached. If this directive is present, only documents from matched words, hosts, or domains are cached (as long as they also satisfy all other caching directives).

Parameter: word | host | domain
  • A word can be any keyword (for example, ProxyCacheOnly hello server good-bye).
  • A host is a fully qualified DNS domain name that can be resolved to one or more IP addresses via the DNS domain name service. It represents a logical host (in contrast to domain, see below) and must be resolvable to at least one IP address (or often to a list of hosts with different IP addresses), otherwise it is simply treated as a word (see above).
  • A domain is a partially qualified DNS domain name, preceded by a period. It represents a group of hosts that logically belong to the same DNS domain or zone (that is, the suffixes of the hostnames are all ending in Domain).
Example
ProxyCacheOnly ibm.com www-1.ibm.com sample.server.edu

For this example, 'sample.server.edu' would also be matched if referenced by IP address since the server records addresses at startup for a match test. Note that 'sample', 'server', 'edu', 'sample.server', or 'server.edu' is sufficient to match 'sample.server.edu' by word, however documents for requests using IP addresses corresponding to 'sample.server.edu' would not be cached since the server could not determine the addresses unless the hostname is specifically listed.

  • CacheMinFileSize, CacheMaxFileSize, and CacheTimeMargin may make documents ineligible for cache prior to consideration for this directive.
  • ProxyNoCache provides counter function. Documents matching a previous ProxyNoCache template in the configuration will not be cached, regardless of whether they match a subsequent ProxyCacheOnly template. In other words, a ProxyNoCache directive may override a ProxyCacheOnly directive if configured prior to the ProxyCacheOnly directive.
  • This directive is used only if CacheRoot is set.
  • Setting ProxyNoConnect to off negates this directive.
Note: "ProxyCacheOnly *" enables caching for all documents if not preceded and matched by a ProxyNoCache directive.

ProxyDomain

Module: mod_proxy
Syntax: ProxyDomain domain
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyDomain .mycompany.com

The ProxyDomain directive specifies the default domain to which the server belongs when acting as a forward proxy server. If a request specifies a host without a domain name, the server sends a response that redirects the client to the host with the configured domain appended. Possible values include all domain names starting with a dot (or period) and consisting only of the characters AZ, AZ, '.' (dot), '-' (dash), and 0-9.

Parameter: domain
  • The domain is a partially qualified DNS domain name, preceded by a period. It represents a group of hosts that logically belong to the same DNS domain or zone (that is, the suffixes of the hostnames are all ending in Domain).
Example
ProxyRemote * http://firewall.mycompany.com:81
NoProxy .mycompany.com 192.168.112.0/21
ProxyDomain .mycompany.com

For this example, if an unqualified request for http://myserver/ comes in, the server will redirect the client to a fully qualified host name using the default domain. That is, the client will be redirected to http://myserver.mycompany.com/.

  • ProxyBlock may be used to block incoming requests prior to consideration for this directive.
  • This directive is commonly used in conjunction with the NoProxy and ProxyRemote directives for directing proxy requests within intranets.
  • Setting ProxyRequests to off negates this directive

ProxyErrorOverride

Module: mod_proxy
Syntax: ProxyErrorOverride on | off
Default: ProxyErrorOverride off
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyErrorOverride on

The ProxyErrorOverride directive specifies if the server is to override error response codes and message text sent by remote servers to enable local error messaging for remote server problems. If disabled (the default), all responses sent by remote servers (including errors) are relayed to clients (local error messaging is not used). If enabled, server related error codes and messages sent by remote servers (codes greater than or equal to 400®) are overridden and local error messaging is used to send responses that pertain to the local server, rather than the remote server. Non-server related error codes (codes less than 400) are not affected by this directive and are always relayed to clients.

Parameter: on | off
  • If off, is specified (the default), all response codes and messages sent by remote servers are relayed to clients (unaltered).
  • If on is specified, error response codes and messages sent by remote servers relating to server problems are overridden and local error messaging is used to send responses to clients.

By default, local error messaging will send hardcoded messages to clients. However, it may be configured to send custom web pages as well, or to redirect certain errors to local CGI programs (or servlets) or remote servers to handle. When ProxyErrorOverride is used in conjunction with ErrorDocument support, custom responses may be sent to clients when proxy requests fail due to remote server problems. This is useful for reverse proxy setups where remote server problems need to be concealed from clients or when web sites must have a common error reporting appearance. It may be used, however, for any proxy setup where remote server errors need to be handled in a certain (customized) manner.

For example, suppose the local server has address http://www.ibm.com/ and the following directives are setup for reverse proxy:

ProxyPass /docs/ http://pubserver.ibm.com/public/documentation/
ProxyErrorOverride on
ErrorDocument proxyrmterror /cgi-bin/proxyerr.pgm

Now further suppose the local server was sent the request http://www.ibm.com/docs/whitepaper.html. The ProxyPass directive will cause the request to be internally converted into a request for http://pubserver.ibm.com/public/documentation/whitepaper.html. The proxy function will then be invoked to retrieve /public/documentation/whitepaper.html from pubserver.ibm.com. The remote server (pubserver.ibm.com) then has an error that causes it to return response code 500 (internal error) to the local server (www.ibm.com). Since ProxyErrorOverride is enabled, the local server overrides the response code (along with any message text) and enables local error messaging to handle the response. Furthermore, since ErrorDocument is setup for such a response (proxyrmterror), the error is passed to the cgi program /cgi-bin/proxyerr.pgm which handles the problem by sending a customized error page to the client.

In this example of a reverse proxy request process, internal server errors from a remote server (pubserver.ibm.com) are concealed from the client since local error messaging is enabled for proxy requests on www.ibm.com. Similar handling may be setup for forward proxy scenarios as well.

  • If custom error messages are not defined (not enabled via ErrorDocument), local error messaging may still be used to send hardcoded messages pertaining to the local server.
  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.

ProxyForceCacheCompletion

Module: mod_proxy
Syntax: ProxyForceCacheCompletion percentage
Default: ProxyForceCacheCompletion 90
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: Multiple LoadModule directives are required in the configuration file prior to using the directive. The statements should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyForceCacheCompletion 60

The ProxyForceCacheCompletion directive specifies a download percentage used to determine whether the server should continue to cache documents after a client cancels a request. If a request for a document is canceled, the server will complete the cache transfer over the connection with the content server if more than the percentage specified has already been received. If the server has received less than the percentage specified, or if the proxy caching function is not enabled (see CacheRoot for details), all data is discarded and the server drops the connection with the content server.

Note: This directive is used only if CacheRoot is set. In addition, if the ProxyNoConnect directive is set to on, it negates the ProxyForceCacheCompletion setting.
Parameter: percentage

The percentage parameter accepts an integer value between 0 and 100 to specify the minimum amount of data the server is to receive (specified as a percentage of the whole document) to continue caching a document, regardless of whether the client's request is canceled.

ProxyIOBufferSize

Module: mod_proxy
Syntax: ProxyIOBufferSize bytes
Default: ProxyIOBufferSize 8192
Context: server, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: CacheTimeMargin 300

The ProxyIOBufferSize directive adjusts the size of the internal buffer, which is used as a scratchpad for the data between input and output. The size must be less or equal 8192, and it is recommended that you do not change the size.

<ProxyMatch>

Module: mod_proxy
Syntax: <ProxyMatch criteria> ... </ProxyMatch>
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: Reverse proxy
ProxyReverse on
ProxyPass /docs/v4r4m0/ http://pubserver.ibm.com/public/v4r4m0/
<ProxyMatch "^http://pubserver.ibm.com/public/v[0-9]r[0-9]m[0-9]/(.*)"> 
  Require all granted
</ProxyMatch>
Example: Forward proxy
<ProxyMatch "^http://server[0-9]r[0-9]m[0-9]/docs/*">
  Require all granted
</ProxyMatch>

The <ProxyMatch> directive is used to enclose a group of directives that apply only to proxy requests that match the specified criteria. Multiple proxy containers are allowed, however they may not be nested. Requests that do not match container criteria are outside the context of the enclosed directives. Any directive allowed within a directory context is also allowed within a proxy context.

Parameter: criteria
  • The criteria parameter accepts a UNIX-style extended regular expression used to identify requests to which the enclosed directives apply. Expressions are used to identify both forward and reverse proxy requests. A match is considered by comparing request URL strings to the specified expression. Subexpressions are grouped within parentheses. Then, parenthetically enclosed regular expressions are substituted in a subsequent $n statement. A match is made if the URL string matches the expression using regular expression logic. For reverse proxy, the specified expression must match the new outgoing URL.

Proxy containers defined by <ProxyMatch> directives (including the directives enclosed by them) are handled in the same way as those defined by <Proxy> directives. The only difference is in how the criteria is specified and handled using regular expressions (for <ProxyMatch>) rather than string literals (for <Proxy>). Refer to <Proxy> for further details regarding proxy containers.

For example, suppose the local server has address http://as400.ibm.com/ and the following directives are setup for reverse proxy:

Example
ProxyPass /v4r3m0/docs/ http://pubserver.ibm.com/public/vrm430/
ProxyPass /v4r4m0/docs/ http://pubserver.ibm.com/public/vrm440/
ProxyPass /v4r5m0/docs/ http://pubserver.ibm.com/public/vrm450/
ProxyPass /v5r1m0/docs/ http://pubserver.ibm.com/public/vrm510/
<ProxyMatch "^http://pubserver.ibm.com/public/v[0-9]r[0-9]m[0-9]/(.*)">
 AuthName "i Document Server"
 AuthType Basic
 Require group admin
 PasswdFile QUSRSYS/DOC_USERS
 GroupFile /groups/doc_readers
</ProxyMatch>

For this example, a request for /v4r5m0/docs/manual.html is identified as a proxy request since it matches the third ProxyPass statement (ProxyPass /v4r5m0/docs/ http://pubserver.ibm.com/public/vrm450/). Once identified as a proxy request, it is compared against criteria specified for the proxy container (ProxyMatch "^http://pubserver.ibm.com/public/v[0-9]r[0-9]m[0-9]/(.*)") using regular expression logic. A match is made and the server applies the directives within the container that requires the client to provide basic authentication credentials (AuthType Basic). If the client is authenticated (PasswdFile QUSRSYS/DOC_USERS) and authorized (GroupFile /groups/doc_readers, or Require group admin) the request will be internally converted into a request for http://publicserver.ibm.com/public/vrm450/manual.html and further handled by the proxy function (see ProxyPass for more information on reverse proxy). If the client is not authenticated or authorized, the request fails.

  • The client is authenticated if a valid userid and password is provided, according to the PasswdFile directive.
  • The client is authorized if the userid (or group) is allowed access, according to the GroupFile or Require directives.

Notice that in the above example the directives enclosed in the proxy container will apply to requests matching any of the ProxyPass directives since the regular expression criteria (specified for <ProxyMatch>) matches all four virtual directory path names specified for ProxyPass.

  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.

Named groups and backreferences are captured and written to the environment with the corresponding name prefixed with "MATCH_" and in upper case. This allows elements of URLs to be referenced from within expressions and modules like mod_rewrite . In order to prevent confusion, numbered (unnamed) backreferences are ignored. Use named groups instead.

For example:

<ProxyMatch "^http://pubserver.ibm.com/public/(?<groupnum>group\d)/(.*)">
    AuthName "i Document Server"
    AuthType Basic
    Require group %{env:MATCH_GROUPNUM}
    PasswdFile QUSRSYS/DOC_USERS
    GroupFile /groups/doc_readers
</ProxyMatch>

ProxyMaxForwards

Module: mod_proxy
Syntax: ProxyMaxForwards maximum
Default: ProxyMaxForwards -1
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyMaxForwards 8

The maximum parameter accepts an integer value no greater than 2,147,483,648 to specify the value the server is to use when it adds Max-Forwards request headers to proxy requests. When the server receives requests that do not contain a Max-Forwards header, it automatically adds one using the specified value. This setting is not used for requests that already contain a Max-Forwards header.

Parameter: maximum
  • The maximum parameter accepts an integer value between 1 and 2,147,483,648 to specify the value the server is to use when it adds Max-Forwards request headers to proxy requests.

The server uses Max-Forwards headers to prevent infinite proxy loops, and possibly certain types of denial of service attacks. This is accomplished by ensuring that a Max-Forwards header is set for all requests to control the maximum number of times it can be forwarded (or passed to subsequent servers).

When the server receives requests containing a Max-Forwards header, it will continue to process the requests only if the value for the header is greater than 0 (zero). If the value is greater than zero, the server decrements it and continues to process the request. If the request subsequently needs to be forwarded to another server, the Max-Forwards header is sent with the decremented value. This process is repeated until the request is fulfilled (or rejected) by a server, or until the value for the Max-Forwards header reaches zero. Once the value reaches zero (or less), the server will not forward the request and will respond immediately (see example, request 3) with the following response codes:

  • If TRACE method is used, 200 (OK) is returned as well as any trace data.
  • If OPTIONS method is used, 200 (OK) is returned as well as any options data.
  • If any other method is used, 502 (BAD_GATEWAY) is returned as well as the server's customized error page for "proxyfail" (if enabled, see ErrorDocument).

This setting is used for both forward and reverse proxy requests.

Example: Forward Proxy
ProxyRequests on
ProxyMaxForwards 8

For this example, consider the following three requests:

Request 1
GET http://docserver.ibm.com/manual.pdf HTTP/1.0

For this request, the server will use the value specified for ProxyMaxForwards (8) to add the new header "Max-Forwards : 8" to the request (since it is not already present), and then forward it to docserver.ibm.com as:

GET /manual.pdf HTTP/1.0
Max-Forwards : 8
Request 2
GET http://docserver.ibm.com/manual.pdf HTTP/1.0
Max-Forwards : 3

For this request, the server will decrement the value for the Max-Forwards header to 2, and then forward the request to docserver.ibm.com as:

GET /manual.pdf HTTP/1.0
Max-Forwards : 2

In this case, the value specified for ProxyMaxForwards is not used since the request already contained a Max-Forwards header.

Request 3
GET http://docserver.ibm.com/manual.pdf HTTP/1.0
Max-Forwards : 0

For this request, the server will immediately return response code 502 (BAD_GATEWAY) since the request cannot be forwarded any further due to the Max-Forwards header value. In this case, docserver.ibm.com is never contacted.

  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.
Note: Setting ProxyMaxForwards is a violation of the HTTP/1.1 protocol (RFC2616), which forbids a Proxy setting Max-Forwards if the Client didn't set it. A negative ProxyMaxForwards value, including the default -1, gives you protocol-compliant behaviour, but may leave you open to loops.

ProxyNoCache

Module: mod_proxy
Syntax: ProxyNoCache word | host | domain
Default: absent [meaning cache all files satisfying other caching directives]
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyNoCache ibm.com www-1.ibm.com sample.example.edu

The ProxyNoCache directive specifies a list of words, hosts, and domains (in any combination), separated by spaces. HTTP and non-passworded FTP documents from matched words, hosts or domains are not cached by the proxy server. The proxy module will also attempt to determine IP addresses of list items, that may be hostnames during startup, and cache them for a match test. If this directive is absent, all documents satisfying all other caching directives (for example: ProxyCacheOnly, CacheMaxFileSize, CacheMinFileSize, etc.) are cached. If this directive is present, documents from matched words, hosts or domains are not cached.

Parameter: word | host | domain
  • A word can consist of any combination of keywords (for example, ProxyNoCache hello server good-bye).
  • The host is a fully qualified DNS domain name that can be resolved to one or more IP address via the DNS domain name service. It represents a logical host (in contrast to domain, see above) and must be resolvable to at least one IP address (or often to a list of hosts with different IP addresses).
  • The domain is a partially qualified DNS domain name, preceded by a period. It represents a list of hosts that logically belong to the same DNS domain or zone (that is, the suffixes of the hostnames are all ending in Domain).
Example
ProxyNoCache ibm.com www-1.ibm.com sample.example.edu

The 'sample.example.edu' would also be matched if referenced by IP address. Note that 'example ' is sufficient to match 'example.edu'.

  • ProxyCacheOnly provides counter function. Documents matching a previous ProxyCacheOnly template in the configuration will be cached, regardless of whether they match a subsequent ProxyNoCache template. In other words, a ProxyCacheOnly directive may override a ProxyNoCache directive if configured prior to the ProxyNoCache directive.
  • This directive is used only if CacheRoot is set.
  • Setting ProxyRequests to off negates this directive.
Note: "ProxyNoCache *" disables caching for all documents if not preceded by the ProxyCacheOnly directive, however garbage collection is not affected.

ProxyNoConnect

Module: mod_proxy
Syntax: ProxyNoConnect on | off
Default: ProxyNoConnect off
Context: server config, virtual host
Override: none
Origin: IBM
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyNoConnect off

The ProxyNoConnect directive specifies if the proxy is to connect to remote content servers to retrieve documents. If the server is not allowed to connect to remote content servers, it can only serve documents from cache.

Parameter: on | off
  • If off is specified, the server may serve documents from cache (if enabled) as well as issue outgoing requests to remote servers to retrieve servable documents (see Example 1, below).
  • If set to on is specified, the proxy may only serve documents from cache (if enabled). It will not establish outgoing connections with remote servers. CacheRoot is required if on is specified (see Example 2, below).
Example 1
ProxyRequests on
ProxyNoConnect off
CacheRoot /QIBM/UserData/HTTPA/CacheRoot/myproxy

In this example, the proxy may serve documents from cache as well as issue outgoing requests to remote servers.

Example 2
ProxyRequests on
ProxyNoConnect on
CacheRoot /QIBM/UserData/HTTPA/CacheRoot

In this example, the proxy may only serve documents from cache. Documents will not be retrieved from remote servers since outgoing connections are not permitted. Since the server is not permitted to retrieve documents, items in cache must be managed by another application or process other than the server itself.

  • CacheRoot is required if this directive is set to on.
  • The ProxyNoConnect directive causes the AllowCONNECT directive to be ineffective. If ProxyNoConnect is present, and AllowCONNECT is also specified, then even if the AllowCONNECT allows a SSL connection to be made on a specific port, the ProxyNoConnect directive dictates that no connections are allowed.

ProxyPass

Module: mod_proxy
Syntax: ProxyPass [path] !|url [key=value [key=value ...]] [nocanon] [interpolate] [noquery]
Default: none
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example:
ProxyPass /docs/confidential/ !
ProxyPass /docs/ http://pubserver.ibm.com/public/documentation/

This directive allows remote servers to be mapped into the space of the local server; the local server does not act as a proxy in the conventional sense, but appears to be a mirror of the remote server. path is the name of a local virtual path; url is a partial URL for the remote server and cannot include a query string.

The ProxyPass directive specifies information used either to identify and map requests into the space of remote servers, or to prevent requests from being mapped into the space of remote servers, when the reverse proxy function is enabled. Multiple ProxyPass directives are allowed. When enabled, the server does not act as a proxy in the conventional sense, but appears to be a mirror of remote servers by transforming requests that match specified (virtual) directory paths into proxy requests using a corresponding partial URL. If the reverse proxy function is not enabled, this directive has no affect (see ProxyReverse).

Parameter One: path | url
  • The path parameter is the name of a local virtual path. When the directive is placed outside a location container, the first parameter accepts a directory name used to identify requests to be handled by the proxy function. The directory name does not need to specify an existing directory, it may be a name used only as a virtual directory for the server.
  • The url parameter is a partial URL for the remote server. When the directive is placed inside a location container, the first parameter accepts a partial URL used to transform matched requests (for the location container) into proxy requests. When matched, the portion of the original request URL that matches the location container criteria is replaced with the specified partial URL. Mapped requests are then handled by the proxy function (see example two).
Parameter Two: !|url [key=value [key=value ...]] [nocanon] [interpolate] [noquery]
  • The !|url [key=value [key=value ...]] [nocanon] [interpolate] [noquery] parameter is used when the directive is placed outside a location container, the second parameter accepts a partial URL or the negation operator (!). Partial URLs are used to transform matched requests into proxy requests by replacing the portion of the original request URL that matches the path parameter (parameter one) with the specified partial URL (parameter two). Mapped requests are then handled by the proxy function. The negation operator is used to prevent requests that match the path parameter (parameter one) from being mapped and handled by the proxy function, even though they may match a succeeding ProxyPass directive. Example one, below, shows both partial URLs and the negation operator being used for multiple ProxyPass directives.
  • mod_proxy supports pooled connections to a backend server. . Using the key=value parameters to tune this connection pooling. .
  • Normally, mod_proxy will canonicalise ProxyPassed URLs. But this may be incompatible with some backends, particularly those that make use of PATH_INFO. The optional nocanon keyword suppresses this, and passes the URL path "raw" to the backend. Note that this keyword affect the security of your backend, as it removes the normal limited protection against URL-based attacks provided by the proxy.
  • The optional interpolate keyword, in combination with ProxyPassInterpolateEnv causes the ProxyPass to interpolate environment variables, using the syntax ${VARNAME}. Note that many of the standard CGI-derived environment variables will not exist when this interpolation happens, so you may still have to resort to mod_rewrite for complex rules. Also note that interpolation is not supported within the scheme portion of a URL. Dynamic determination of the scheme can be accomplished with mod_rewrite as in the following example.
           RewriteEngine On
           RewriteCond %{HTTPS} =off
           RewriteRule . - [E=protocol:http]
           RewriteCond %{HTTPS} =on
           RewriteRule . - [E=protocol:https]
           RewriteRule ^/mirror/foo/(.*) %{ENV:protocol}://backend.example.com/$1 [P]
           ProxyPassReverse  /mirror/foo/ http://backend.example.com/
           ProxyPassReverse  /mirror/foo/ https://backend.example.com/
  • Normally, mod_proxy will include the query string when generating the SCRIPT_FILENAME environment variable. The optional noquery keyword prevents this.

The server functions as a reverse proxy by mapping requests for documents inside virtual directories (specified by the path parameter or location container criteria) into the space of remote servers (specified by the url parameter). It then retrieves the documents (via proxy), and serves them while making it appear to the client as if they originated from the local server.

The negation operator (!) is used to prevent specific virtual subdirectories to be mapped into the space of remote servers, while allowing higher level (parent) directories to be mapped. Order is important in these situations. ProxyPass directives using the negation operator to prevent specific virtual subdirectories from being mapped must be placed before those mapping higher level (parent) directories (see example one).

Suppose the local server has address http://iseries.ibm.com/:

Example 1
ProxyReverse on
ProxyPass /docs/v4r5m0/ http://pubserver.ibm.com/public/v4r5m0/
ProxyPass /docs/archives/confidential/ !
ProxyPass /docs/archives/private/ !
ProxyPass /docs/archives/ http://pubserver.ibm.com/archives/documents/example

For this example, since the reverse proxy function is enabled (ProxyReverse on), the first ProxyPass directive will cause a local request for /docs/v4r5m0/manual.html to be internally transformed into a request for http://pubserver.ibm.com/public/v4r5m0/manual.html. The proxy function will then be used to retrieve /public/v4r5m0/manual.html from pubserver.ibm.com and return the document to the requesting client. In this way, a virtual /docs/v4r5m0/ directory on the local server (as400.ibm.com) appears as a mirror of the /public/v4r5m0/ directory of the remote server (pubserver.ibm.com). A request for /docs/archives/20020101.log will be handled in a similar way, using the last ProxyPass directive (ProxyPass /docs/archives/ http://pubserver.ibm.com/archives/documents/). However, a request for /docs/archives/confidential/secrets.txt will not be handled by the proxy function since the second ProxyPass directive prohibits any request for documents within the /docs/archives/confidential/ virtual subdirectory. Likewise, the third ProxyPass directive prohibits any request for documents within the /docs/archives/private/ virtual subdirectory.

The following example shows the ProxyPass directive being used within a location container to obtain results similar to example 1.

Example Two
ProxyReverse on
<Location /docs/v4r5m0/>
 ProxyPass http://pubserver.ibm.com/public/v4r5m0/ 
</Location>
ProxyPass /docs/archives/confidential/ !
ProxyPass /docs/archives/private/ !
ProxyPass /docs/archives/ http://pubserver.ibm.com/archives/documents/

Notice the first ProxyPass directive is placed within a location container and specifies only one parameter. A local request for /docs/v4r5m0/manual.html is identified by matching the location container criteria (/docs/v4r5m0/), transformed into a request for http://pubserver.ibm.com/public/v4r5m0/manual.html by replacing the matched portion with the ProxyPass parameter, and handled by the proxy function in the same way described for example one.

  • ProxyPassReverse may be used to handle HTTP redirect responses from remote servers.
  • Setting ProxyReverse to off negates this directive.
  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state. The ProxyRequests directive should usually be set off when using ProxyPass.

Ordering ProxyPass Directives

The configured ProxyPass and <ProxyMatch> rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first. Otherwise later rules for longer URLS will be hidden by any earlier rule which uses a leading substring of the URL. Note that there is some relation with worker sharing. In contrast, only one ProxyPass directive can be placed in a Location block, and the most specific location will take precedence. For the same reasons exclusions must come before the general ProxyPass directives.

ProxyPass key=value Parameters

mod_proxy supports pooled connections to a backend server. Connections created on demand can be retained in a pool for future use. Limits on the pool size and other settings can be coded on the ProxyPass directive using key=value parameters, described in the table below.

By default, mod_proxy will allow and retain the maximum number of connections that could be used simultaneously by that web server child process. Use the max parameter to reduce the number from the default. Use the ttl parameter to set an optional time to live; connections which have been unused for at least ttl seconds will be closed. ttl can be used to avoid using a connection which is subject to closing because of the backend server's keep-alive timeout.

Example

ProxyPass /example http://backend.example.com max=20 ttl=120 retry=300 
Table 1. BalancerMember parameters
Parameter Default Description
min 0 Minumum number of connections that will always be open to the backend server.
max 1...n Maximum number of connections that will be allowed to the backend server. The default for a Maximum for the number of connections is the number of threads per process in the active MPM. With the Worker MPM it is controlled by the ThreadsPerChild. HTTP server will never create more than the Hard Maximum connections to the backend server. If max is is set to 0 not specified, it will be set to ThreadsPerChild.
smax max Retained connection pool entries above this limit are freed during certain operations if they have been unused for longer than the time to live, controlled by the ttl parameter. If the connection pool entry has an associated connection, it will be closed. This only needs to be modified from the default for special circumstances where connection pool entries and any associated connections which have exceeded the time to live need to be freed or closed more aggressively.
acquire - If set this will be the maximum time to wait for a free connection in the connection pool, in milliseconds. If there are no free connections in the pool the HTTP server will return SERVER_BUSY status to the client.
connectiontimeout Timeout Connect timeout in seconds. The number of seconds HTTP server waits for the creation of a connection to the backend to complete. By adding a postfix of ms the timeout can be also set in milliseconds.
disablereuse Off This parameter should be used when you want to force mod_proxy to immediately close a connection to the backend after being used, and thus, disable its persistent connection and pool for that backend. This helps in various situations where a firewall between HTTP server and the backend server (regardless of protocol) tends to silently drop connections or when backends themselves may be under round- robin DNS. To disable connection pooling reuse, set this property value to On.
enablereuse On This is the inverse of 'disablereuse' above, provided as a convenience for scheme handlers that require opt-in for connection reuse.
flushwait 10 The time to wait for additional input, in milliseconds, before flushing the output brigade if 'flushpackets' is 'auto'.
iobuffersize 8192 Adjusts the size of the internal scratchpad IO buffer. This allows you to override the ProxyIOBufferSize for a specific worker. This must be at least 512 or set to 0 for the system default of 8192.
keepalive Off

This parameter should be used when you have a firewall between your HTTP server and the backend server, which tends to drop inactive connections. This flag will tell the Operating System to send KEEP_ALIVE messages on inactive connections and thus prevent the firewall from dropping the connection. To enable keepalive set this property value to On.

The frequency of initial and subsequent TCP keepalive probes depends on global OS settings, and may be as high as 2 hours. To be useful, the frequency configured in the OS must be smaller than the threshold used by the firewall.

lbset 0 Sets the load balancer cluster set that the worker is a member of. The load balancer will try all members of a lower numbered lbset before trying higher numbered ones.
ping 0 Ping property tells the webserver to "test" the connection to the backend before forwarding the request. For HTTP, it causes mod_proxy_http to send a 100-Continue to the backend (only valid for HTTP/1.1 - for non HTTP/1.1 backends, this property has no effect). The parameter is the delay in seconds to wait for the reply. This feature has been added to avoid problems with hung and busy backends. This will increase the network traffic during the normal operation which could be an issue, but it will lower the traffic in case some of the cluster nodes are down or busy. By adding a postfix of ms the delay can be also set in milliseconds.
loadfactor 1 Worker load factor. Used with BalancerMember. It is a number between 1 and 100 and defines the normalized weighted load applied to the worker.
receivebuffersize 0 Adjusts the size of the explicit (TCP/IP) network buffer size for proxied connections. This allows you to override the ProxyReceiveBufferSize for a specific worker. This must be at least 512 or set to 0 for the system default.
redirect - Redirection Route of the worker. This value is usually set dynamically to enable safe removal of the node from the cluster. If set, all requests without a session id will be redirected to the BalancerMember that has route parameters equal to this value.
retry 60 Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, HTTP server will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance, and bring it back online later.
route - Route of the worker when used inside load balancer. The route is a value appended to session id.
status -

Single letter value defining the initial status of this worker:

D: Worker is disabled and will not accept any requests.

S: Worker is administratively stopped.

I: Worker is in ignore-errors mode, and will always be considered available.

H: Worker is in hot-standby mode and will only be used if no other viable workers are available.

E: Worker is in an error state.

N: Worker is in drain mode, and will only accept existing sticky sessions destined for itself and ignore all other requests.

Status can be set (which is the default) by prepending with '+' or cleared by prepending with '-'. Thus, a setting of 'S-E' sets this worker to Stopped and clears the in-error flag.

timeout ProxyTimeout Connection timeout in seconds. The number of seconds HTTP server waits for data sent by / to the backend.
ttl - Time to live for inactive connections and associated connection pool entries, in seconds. Once reaching this limit, a connection will not be used again; it will be closed at some later time.

If the Proxy directive scheme starts with the balancer:// (eg: balancer://cluster, any path information is ignored) then a virtual worker that does not really communicate with the backend server will be created. Instead it is responsible for the management of several "real" workers. In that case the special set of parameters can be add to this virtual worker. See mod_proxy_balancer for more information about how the balancer works.

Table 2. Balancer parameters
Parameter Default Description
lbmethod byrequests Balancer load-balance method. Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting or bytraffic, to perform weighted traffic byte count balancing, or bybusyness, to perform pending request balancing. The default is byrequests.
maxattempts One less than the number of workers, or 1 with a single worker. Maximum number of failover attempts before giving up.
nofailover Off If set to On the session will break if the worker is in error state or disabled. Set this value to On if backend servers do not support session replication.
stickysession - Balancer sticky session name. The value is usually set to something like JSESSIONID or PHPSESSIONID, and it depends on the backend application server that support sessions. If the backend application server uses different name for cookies and url encoded id (like servlet containers) use | to separate them. The first part is for the cookie the second for the path.
scolonpathdelim Off If set to On the semi-colon character ';' will be used as an additional sticky session path delimiter/separator. This is mainly used to emulate mod_jk's behavior when dealing with paths such as JSESSIONID=6736bcf34;foo=aabfa
timeout 0 Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. The default is not to wait.
failonstatus - A single or comma-separated list of HTTP status codes. If set this will force the worker into error state when the backend returns any status code in the list. Worker recovery behaves the same as other worker errors.
nonce <auto> The protective nonce used in the balancer-manager application page. The default is to use an automatically determined UUID-based nonce, to provide for further protection for the page. If set, then the nonce is set to that value. A setting of None disables all nonce checking.
Note: In addition to the nonce, the balancer-manager page should be protected via an ACL.
growth 0 Number of additional BalancerMembers to allow to be added to this balancer in addition to those defined at configuration.
forcerecovery On Force the immediate recovery of all workers without considering the retry parameter of the workers if all workers of a balancer are in error state. There might be cases where an already overloaded backend can get into deeper trouble if the recovery of all workers is enforced without considering the retry parameter of each worker. In this case set to Off.
Example 1: A sample balancer setup

ProxyPass /special-area http://special.example.com smax=5 max=10

ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On

<Proxy balancer://mycluster>
    BalancerMember http://1.2.3.4:8009
    BalancerMember http://1.2.3.5:8009 loadfactor=20
    # Less powerful server, don't send as many requests there,
    BalancerMember http://1.2.3.6:8009 loadfactor=5
</Proxy>
Example 2:Setting up a hot-standby, that will only be used if no other members are available

ProxyPass / balancer://hotcluster/

<Proxy balancer://hotcluster>
    BalancerMember http://1.2.3.4:8009 loadfactor=1
    BalancerMember http://1.2.3.5:8009 loadfactor=2
    # The server below is on hot standby
    BalancerMember http://1.2.3.6:8009 status=+H
    ProxySet lbmethod=bytraffic
</Proxy>
Note: The ProxyPass directive is not supported in <Directory> or <Files> sections.

When used inside a <Location> section, the first argument is omitted and the local directory is obtained from the <Location>. The same will occur inside a <LocationMatch> section, however ProxyPass does not interpret the regular expression as such, so it is necessary to use ProxyPassMatch in this situation instead.

If you require a more flexible reverse-proxy configuration, see the RewriteRule directive with the [P] flag.

ProxyPassInherit

Module: mod_proxy
Syntax: ProxyPassInherit on | off
Default: ProxyPassInherit On
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPassInherit off

The ProxyPassInherit directive will cause the current server/virtual host to "inherit" ProxyPass directives defined in the main server.

Note: This can cause issues and inconsistent behavior if using the Balancer Manager for dynamic changes and so should be disabled if using that feature

The setting in the global server defines the default for all vhosts.

Disabling ProxyPassInherit also disables BalancerInherit.

ProxyPassInterpolateEnv

Module: mod_proxy
Syntax: ProxyPassInterpolateEnv on | off
Default: ProxyPassInterpolateEnv Off
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPassInterpolateEnv On

The ProxyPassInterpolateEnv directive, together with the interpolate argument to ProxyPass, ProxyPassReverse, ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath enables reverse proxies to be dynamically configured using environment variables, which may be set by another module such as mod_rewrite . It affects the ProxyPass, ProxyPassReverse, ProxyPassReverseCookieDomain, and ProxyPassReverseCookiePath directives, and causes them to substitute the value of an environment variable varname for the string ${varname} in configuration directives (if the interpolate option is set).

Note: Keep this turned off (for server performance) unless you need it!

ProxyPassMatch

Module: mod_proxy
Syntax: ProxyPassMatch [regex] !|url [key=value [key=value ...]]
Default: none
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPassMatch ^/(.*\.gif)$ http://backend.example.com/$1

The ProxyPassMatch directive is equivalent to ProxyPass , but makes use of regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the url, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a new url.

Example

Suppose the local server has address http://example.com/; then ProxyPassMatch "^/(.*\.gif)$" "http://backend.example.com/$1" will cause a local request for http://example.com/foo/bar.gif to be internally converted into a proxy request to http://backend.example.com/foo/bar.gif.

The ! directive is useful in situations where you don't want to reverse-proxy a subdirectory. When used inside a <LocationMatch> section, the first argument is omitted and the regular expression is obtained from the <LocationMatch>. If you require a more flexible reverse-proxy configuration, see the RewriteRule directive with the [P] flag.

Note: The ProxyPassMatch directive is not supported in <Directory> or <Files> sections.

ProxyPassReverse

Module: mod_proxy
Syntax: ProxyPassReverse [path] url [interpolate]
Default: none
Context: server config, virtual host, directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPassReverse /docs/ http://pubserver.ibm.com/public/documentation/

The ProxyPassReverse directive lets Apache adjust the URL in the Location, Content-Location and URI headers on HTTP redirect responses. This is essential when Apache is used as a reverse proxy to avoid by-passing the reverse proxy because of HTTP redirects on the backend servers which stay behind the reverse proxy.

The ProxyPassReverse directive may specify a directory path and a partial URL used to identify and adjust URLs in response headers returned to the client (via proxy). Multiple ProxyPassReverse directives are allowed.

Only the HTTP response headers specifically mentioned above will be rewritten. Apache will not rewrite other response headers, nor will it by default rewrite URL references inside HTML pages. This means that if the proxied content contains absolute URL references, they will by-pass the proxy. To rewrite HTML content to match the proxy, you must load and enable mod_proxy_html .

Parameter One: path | url
  • The path parameter is the name of a local virtual path. When the directive is placed outside a location container, the first parameter accepts a directory name used to adjust response header values. If URLs specified in response headers match the url parameter (parameter two), the portion that matches is replaced with the specified directory name. Adjusted headers are then returned to the client. The directory name does not need to specify an existing directory, it may be a name used only as a virtual directory for the server.
  • The url parameter is a partial URL for the remote server. When the directive is placed inside a location container, the first parameter accepts a partial URL used to identify URLs in URI, Location, and Content-Location response headers returned to the server as requested by the proxy function. If any of these request headers match the specified partial URL, the portion that matches is replaced with the directory name specified for the location container. Adjust headers are then returned to the client.
Parameter Two: url
  • The url parameter is a partial URL for the remote server. When the directive is placed outside a location container, the second parameter accepts a partial URL used to identify URLs in URI, Location, and Content-Location response headers returned to the server as requested by the proxy function.
  • When the directive is placed inside a location container a second parameter cannot be specified.

This directive provides support to be used in applications when it is essential that clients are not directed to use URLs that bypass the proxy function. It is mainly intended to provide additional function for reverse proxy, however it may also be applied to forward proxy requests handled by the server.

Suppose the local server has address http://iseries.ibm.com:

Example
ProxyReverse on
ProxyPass /docs/v4r4m0/ http://pubserver.ibm.com/public/v4r4m0/
ProxyPass /docs/v4r5m0/ http://pubserver.ibm.com/public/v4r5m0/
ProxyPass /docs/v5r1m0/ http://pubserver.ibm.com/public/v5r1m0/
ProxyPassReverse /docs/ http://pubserver.ibm.com/public/
ProxyPass /docs/archives/ http://pubserver.ibm.com/archives/

For this example, since the reverse proxy function is enabled (ProxyReverse on), a request for /docs/v4r4m0/api_reference.htm will be internally transformed into a proxy request for http://pubserver.ibm.com/public/v4r4m0/API_reference.htm (the functionality the first ProxyPass directive provides here). The use of ProxyPassReverse adjusts URLs in URI, Location, and Content-Location response headers from pubserver.ibm.com. Therefore, when the server's request is subsequently redirected by pubserver.ibm.com with the following response:

301 "Permanently Moved"
Location: http://pubserver.ibm.com/public/archives/440/API_reference.htm
{other response headers}

{optional body text}

The server changes the matching portion of the URL in the Location header (http://pubserver.ibm.com/public/) to the virtual server path (/docs/) before sending the following (adjusted) response to the client:

301 "Permanently Moved"
Location: http://as400.ibm.com/docs/archives/440/API_reference.htm
{other response headers}

{optional body text}

In this way, any new request the client sends due to the redirect response (301 "Permanently Moved") is directed back to the proxy since the Location header is adjusted. The back end server and path name (http://pubserver.ibm.com/public/) remain hidden from the client.

  • This directive is only useful when used in conjunction with the ProxyPass directive.
  • Setting ProxyReverse to off negates this directive.
  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the proxy state.
  • Note that this ProxyPassReverse directive can also be used in conjunction with the proxy feature (RewriteRule ... [P]) from mod_rewrite because it doesn't depend on a corresponding ProxyPass directive.
  • The optional interpolate keyword, used together with ProxyPassInterpolateEnv, enables interpolation of environment variables specified using the format ${VARNAME}. Note that interpolation is not supported within the scheme portion of a URL.
  • When used inside a <Location> section, the first argument is omitted and the local directory is obtained from the <Location>. The same occurs inside a <LocationMatch> section, but will probably not work as intended, as ProxyPassReverse will interpret the regexp literally as a path; if needed in this situation, specify the ProxyPassReverse outside the section, or in a separate <Location> section.
  • This directive is not supported in <Directory> or <Files> sections.

ProxyPassReverseCookieDomain

Module: mod_proxy
Syntax: ProxyPassReverseCookieDomain internal-domain public-domain
Default: none
Context: Server, Virtual Host, Directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPassReverseCookieDomain internal.domain.com www.company.com

The ProxyPassReverseCookieDomain directive adjusts the Domain string in Set-Cookie headers from a reverse- proxied server. The usage of the ProxyPassReverseCookieDomain directive is similar to ProxyPassReverse, but instead of rewriting headers that are a URL it rewrites the domain string in Set-Cookie headers.

ProxyPassReverseCookiePath

Module: mod_proxy
Syntax: ProxyPassReverseCookiePath internal-path public-path
Default: none
Context: Server, Virtual Host, Directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM

The ProxyPassReverseCookiePath directive adjusts the Path string in Set-Cookie headers from a reverse- proxied serve. The usage of the ProxyPassReverseCookiePath directive is similar to ProxyPassReverse, but instead of rewriting headers that are a URL, this rewrites the path string in Set-Cookie headers.

ProxyPreserveHost

Module: mod_proxy
Syntax: ProxyPreserveHost on | off
Default: ProxyPreserveHost off
Context: server config, virtual host, Directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyPreserveHost on

The ProxyPreserveHost directive specifies whether the server is to preserve Host: headers when handling requests using the reverse proxy function.

Parameter: on | off
  • If off is specified (the default), the server generates Host: headers for requests handled by the reverse proxy function, using the hostname (and optionally a port number) specified for the ProxyPass or RewriteRule directives.
  • If on is specified, the server uses Host: headers sent with requests, rather than generating Host: headers, and uses the hostname (and optional port) specified for the ProxyPass or RewriteRule directives only to route the request.

Suppose, for example, the local server has the address http://as400.ibm.com/ with the following directive set up for reverse proxy:

Example
ProxyPass /docs/ http://pubserver.ibm.com:8080/public/documentation/
ProxyPreserveHost on

The server in this example is sent the following request:

GET /docs/manual.html HTTP/1.0
Host: virtual-host.ibm.com
{other request headers}

{optional body text}

The ProxyPass directive will cause the request to be internally transformed into a request for http://pubserver.ibm.com:8080/public/documentation/manual.html, and the ProxyPreserveHost directive will cause the Host: header to be preserved and passed by the proxy function, resulting in the following request sent to pubserver.ibm.com:

GET /public/documentation/manual.html HTTP/1.0
Host: virtual-host.ibm.com
{other request headers}

{optional body text}

If off were specified for ProxyPreserveHost, the Host: header would not be preserved. The server, in this case, would generate a Host: header, resulting in the following request:

GET /public/documentation/manual.html HTTP/1.0
Host: pubserver.ibm.com:8080
{other request headers}

{optional body text}
  • ProxyPassReverse may be used to handle HTTP redirect responses from remote servers.
  • Setting ProxyReverse to off negates this directive.
  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.
Note: This option should normally be turned Off. It is mostly useful in special configurations like proxied mass name-based virtual hosting, where the original Host header needs to be evaluated by the backend server.

ProxyReceiveBufferSize

Module: mod_proxy
Syntax: ProxyReceiveBufferSize bytes
Default: ProxyReceiveBufferSize 0
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyReceiveBufferSize 2048 The ProxyReceiveBufferSize directive specifies an explicit network buffer size for outgoing HTTP and FTP connections (for increased throughput). This directive effectively overrides the server's default TCP/IP buffer size. Possible values include 0 (zero) and all positive integers greater than or equal to 512 (the maximum value is 2,147,483,647 bytes). The value 0 (zero) indicates the system's default buffer size should be used.
Parameter: bytes
  • The bytes parameter has to be greater than '512' or set to '0' to indicate that the system's default buffer size should be used.

ProxyRemote

Module: mod_proxy
Syntax: ProxyRemote match remote-server
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyRemote ftp http://ftpproxy.mydomain.com:8080

The ProxyRemote directive defines remote proxies for the local server. Multiple ProxyRemote directives are allowed. When a client sends a request that matches a ProxyRemote directive, the local server connects to the remote proxy server specified in the directive, rather than to the server specified in the URL. The remote proxy server retrieves the requested document and returns it to the local server, who in turn returns it to the client. This is referred to as a "proxy chain" since more than one proxy is used.

Proxy chains are useful in cases where multiple caches are used, or when the local server doesn't support the protocol (or schema) specified in the URL and must chain the request to a proxy that does support the protocol. Proxy chains may also be useful in cases where certain requests must be chained to another proxy server in order to get through a firewall or route across a virtual private network.

Parameter One: match
  • The match parameter is either the name of a URL scheme that the remote proxy server supports, a partial URL that can be used to distinguish requests that should be chained from requests that need not be chained, or '*' to indicate the remote proxy server should be contacted (or chained) for all requests.
Parameter Two: remote-server
  • The remote-server parameter is a partial URL for the remote server.

    Syntax: <remote-server>=<protocol>://<hostname>[:port]

    Where <protocol> is the protocol that should be used to communicate with the remote server. Only HTTP is supported by this module.

Example 1
ProxyRemote ftp http://ftpproxy.server.com:8080
Example 2
ProxyRemote http://server.com/ http://mirrorserver.com:8000
Example 3
ProxyRemote * http://server.com

In example 1, the server will forward (or chain) all FTP requests, encapsulated as yet another HTTP proxy request, to the server named ftpproxy.server.com (port 8080), which then handles the request and returns the document to the local server.

In example 2, the server will forward all requests that match the partial URL http://server.com/ to the server named mirrorserver.com (port 8000).

In example 3, all requests will be forwarded to the server named server.com.

  • ProxyBlock may be used to block incoming requests prior to consideration for this directive.
  • Requests matching a NoProxy directive are not chained.
  • This directive is commonly used in conjunction with NoProxy and ProxyDomain for directing proxy requests within intranets.
  • Setting ProxyNoConnect to on negates this directive.

ProxyRemoteMatch

Module: mod_proxy
Syntax: ProxyRemoteMatch regex remote-server
Default: none
Context: server, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyRemote ftp http://ftpproxy.mydomain.com:8080

The ProxyRemoteMatch is identical to the ProxyRemote directive, except the first argument is a regular expression match against the requested URL.

ProxyRequests

Module: mod_proxy
Syntax: ProxyRequests on | off
Default: ProxyRequests off
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyRequests on

The ProxyRequest directive allows or prevents the server from functioning as a forward proxy.

Parameter: on | off
  • If set to off , the server does not function as a forward proxy (see Example 1, below).
  • If set to on, the server functions as a forward proxy and accepts proxy requests. All other directives for the mod_proxy module are in effect.
Example 1
ProxyRequests off
Example 2
    ProxyRequests on 
    CacheRoot /QIBM/UserData/HTTPA/CacheRoot 
Example 3
    ProxyRequests on 
    ProxyNoConnect on 
    CacheRoot /QIBM/UserData/HTTPA/CacheRoot 
Example 4
    ProxyRequests on 
    CacheExpiryCheck off 
    CacheRoot /QIBM/UserData/HTTPA/CacheRoot 
  • If CacheRoot is set, the proxy also activates its caching function and may serve documents from cache (by default) as well as issue direct outgoing requests (by default) (see Example 2, above). Expiry checking for cached documents is performed (by default).
  • If CacheRoot is set and ProxyNoConnect is set to on, the proxy activates its caching function but will only serve documents from cache. It will not issue outgoing requests (see Example 3, above). Expiry checking for cached documents is performed.
  • If CacheRoot is set and CacheExpiryCheck is set to off, the proxy activates its caching function but will not check expiry times for cached documents. Expired documents may be served from cache (see Example 4, above).
  • Setting ProxyRequests to off negates all directives for the mod_proxy module, except for the ProxyPass and ProxyPassReverse directives.

ProxyReverse

Module: mod_proxy
Syntax: ProxyReverse on | off
Default: ProxyReverse on
Context: server config, virtual host
Override: none
Origin: IBM
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyReverse off

The ProxyReverse directive specifies whether the server may function as a reverse proxy to handle requests. The reverse proxy function is enabled by default, however other directives must specify how the server identifies and maps requests for reverse proxy. If off is specified, the reverse proxy function is disabled, and directives that apply the function (ProxyPass and RewriteRule directives using the 'proxy' flag) are ineffective. See ProxyPass and RewriteRule for more details on reverse proxy.

Parameter: on | off
  • If set to off , the server does not function as a reverse proxy (see Example 1).
  • If set to on, the server functions as a reverse proxy to handle requests identified and mapped for reverse proxy
Example 1
ProxyReverse off
ProxyPass /docs/ http://pubserver.ibm.com/public/documentation/

For example one, the reverse proxy function is disabled. The ProxyPass directive is ineffective.

In the following example, the reverse proxy function is enabled. The server functions as a reverse proxy to handle requests that match the path specified for the ProxyPass directive.

Example 2
ProxyReverse on
ProxyPass /docs/ http://pubserver.ibm.com/public/documentation/

See ProxyPass for more details.

Proxyset

Module: mod_proxy
Syntax: ProxySet [path] [key=value key=value ...]]
Default: none
Context: server config, Virtual Host, Directory
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule balancer_proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example:
RewriteRule ^/mbp/(.*) balancer://ourcluster/$1 [P] 
<Proxy balancer://myCluster> 
.....
ProxySet stickysession=OUR_COOKIE timeout=20 nofailover=On 
</Proxy>
<Proxy "balancer://hotcluster"> 
    BalancerMember "http://www2.example.com:8080" loadfactor=1
    BalancerMember "http://www3.example.com:8080" loadfactor=2
    ProxySet lbmethod=bytraffic
 </Proxy>
ProxySet "balancer://foo" lbmethod=bytraffic timeout=15
The ProxySet is similar to the ProxyPass directive. If the ProxySet directive scheme starts with the balancer:// then a virtual worker that does not really communicate with the backend server will be created. Instead it is responsible for the management of several "real" workers. In that case the special set of parameters can be added to this virtual worker. These same parameters can also be added to the ProxySet directive when balancer:// is specified. The following table displays the parameters for all proxy workers in a group or cluster.
Table 3. ProxySet parameters
Header Default Description
lbmethod byrequests Balancer load-balance method. Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting or bytraffic, to perform weighted traffic byte count balancing, or bybusyness, to perform pending request balancing. Default is byrequests.
maxattempts One less than the number of workers, or 1 with a single worker. Maximum number of failover attempts before giving up.
nofailover Off If set to On the session will break if the worker is in error state or disabled. Set this value to On if backend servers do not support session replication.
stickysession - Balancer sticky session name. The value is usually set to something like JSESSIONID or PHPSESSIONID, and it depends on the backend application server that support sessions. If the backend application server uses different name for cookies and url encoded id (like servlet containers) use | to separate them. The first part is for the cookie the second for the path.
stickysessionsep "." Sets the separation symbol in the session cookie. Some backend application servers do not use the '.' as the symbol. For example the Oracle Weblogic server uses '!'. The correct symbol can be set using this option. The setting of 'Off' signifies that no symbol is used.
scolonpathdelim Off If set to On the semi-colon character ';' will be used as an additional sticky session path delimiter/separator. This is mainly used to emulate mod_jk's behavior when dealing with paths such as JSESSIONID=6736bcf34;foo=aabfa
timeout 0 Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. The default is not to wait.
failonstatus - A single or comma-separated list of HTTP status codes. If set this will force the worker into error state when the backend returns any status code in the list. Worker recovery behaves the same as other worker errors.
failontimeout Off If set, an IO read timeout after a request is sent to the backend will force the worker into error state. Worker recovery behaves the same as other worker errors.
nonce <auto> The protective nonce used in the balancer-manager application page. The default is to use an automatically determined UUID-based nonce, to provide for further protection for the page. If set, then the nonce is set to that value. A setting of None disables all nonce checking.
Note: In addition to the nonce, the balancer-manager page should be protected via an ACL.
growth 0 Number of additional BalancerMembers to allow to be added to this balancer in addition to those defined at configuration.
forcerecovery On Force the immediate recovery of all workers without considering the retry parameter of the workers if all workers of a balancer are in error state. There might be cases where an already overloaded backend can get into deeper trouble if the recovery of all workers is enforced without considering the retry parameter of each worker. In this case set to Off.

You MUST specify the ProxySet directive AFTER the BalancerMember directives.

ProxySourceAddress

Module: mod_proxy
Syntax: ProxySourceAddress address
Default: none
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxySourceAddress 192.168.0.100

The ProxySourceAddress directive allows to set a specific local address to bind to when connecting to a backend server.

ProxyTimeout

Module: mod_proxy
Syntax: ProxyTimeout period
Default: none (the general server timeout value is used)
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyTimeout 300

The ProxyTimeout directive specifies the maximum number of minutes the server will wait for responses from remote servers when handling proxy requests. If not specified, the general server timeout value is used (see the TimeOut directive).

Parameter: period
  • The period parameter accepts an integer value between 1 and 2,147,483,648 to specify the maximum period of time the server should wait for responses from remote servers (in seconds).

If a response is not received in the specified number of seconds, the server will cancel the request and return response code 504 (Gateway timeout).

Example
ProxyTimeout 120

For this example, the server will wait up to 120 seconds (or 2 minute) for responses from remote servers.

  • ProxyPassReverse may be used to handle HTTP redirect responses from remote servers.
  • Setting ProxyReverse to off negates this directive.
  • Setting ProxyRequests to off does not negate this directive. It is available regardless of the forward proxy state.

ProxyVia

Module: mod_proxy
Syntax: ProxyVia off | on | full | block
Default: ProxyVia off
Context: server config, virtual host
Override: none
Origin: Apache
Usage Considerations: A LoadModule is required in the configuration file prior to using the directive. The statement should be as follows:
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Example: ProxyVia on

The ProxyVia directive controls the server's use of the Via: HTTP header. Its intended use is to control the flow of proxy requests along a chain of servers. See RFC2068 (HTTP/1.1) for an explanation of Via: header lines.

Parameter: off | on | full | block
  • If set to off (the default value), no special processing is performed. The proxy does not include a Via: header line, however any existing Via: headers from other proxy servers are kept intact.
  • If set to on , each request and reply will get a Via: header line added for the current host. The proxy includes its own, abbreviated Via: header line. Any additional Via: header lines from other proxy servers are kept intact.
  • If set to full, each generated Via: header line will additionally have HTTP Server version shown on the Via: comment field. The proxy includes its own, full Via: header (containing the proxy's version description). Any additional Via: header lines from other proxy servers are kept intact.
  • If set to block, every proxy request will have all its Via: header lines removed. No new Via: header will be generated. The proxy does not include a Via: header and removes all existing Via headers from other proxy servers.

A server may be a participant in a proxy chain even though it is not specifically configured to chain its own requests. For this reason, it may be necessary to control the server's use of the Via: HTTP header even though it is not specifically configured for proxy chaining (see ProxyRemote for more details about proxy chains).