2.3.100 ProxyPass
ProxyPass specifies the request to be transferred to the backend server, and the address that is to be the forwarding destination.
Description
ProxyPass specifies the request from the web browser and the address of the backend server which the request is sent, when a reverse proxy is used.
Note that the following modules must be built-in to use a reverse proxy:
-
mod_proxy module
LoadModule proxy_module modules/mod_proxy.so
-
mod_proxy_http module
LoadModule proxy_http_module modules/mod_proxy_http.so
Syntax
ProxyPass path_name {URL|!} [key=value [key=value ...]]
Specifiable values
- path_name
-
Specify the request from the web browser to the reverse proxy in the URL beginning with a forward slash (/).
- URL
-
Specify the URL of the backend server that is to be the forward destination in a format that includes http://IP_address_or_host_name[:port_number]/.
An IPv6 address or a host name that corresponds to an IPv6 address can be specified in the URL also.
When using this value in the load balancer configuration that uses mod_proxy_balancer, specify balancer://cluster_name/. A cluster name is a character string that correlates with the <Proxy> directive. Do not include / in the cluster name. In the load balancer configuration that uses mod_proxy_balancer, the <Proxy> directive and the BalancerMember directive must be specified at the same time.
- !
-
Specify this value to exclude the request specified in the path name from the requests that are to be sent from the web browser to the reverse proxy.
- key
-
The keys that can be specified when the URL begins with http:// or with balancer:// differ.
The specifiable keys for each case are as follows:
-
Keys that can be specified when the URL begins with http://:
Key
Value
Content
timeout
1 to 65,535 (unit: seconds)
Specify the waiting time for transmission to or from the next backend server.
-
Waiting time when the data cannot be sent during a request transmission to the backend server
-
Waiting time of receiving a response after the request is sent to the backend server
-
Waiting time when the data cannot be received during a response from the backend server
The default value when this key is omitted is the value specified in the ProxyTimeout directive.
connectiontimeout
1 to 65,535 (unit: seconds)
Specify the waiting time when connecting to the backend server.
The default value when this key is omitted is the value specified in the timeout key.
-
Keys that can be specified when the URL begins with balancer://:
Key
Value
Content
lbmethod
byrequests
Specify the distribution algorithm of the load balancer.
byrequests: Distributed according to the number of requests
When the key is omitted, the distribution is performed according to byrequests.
stickysession
Character string less than 64 bytes
Specify the cookie name to be used when determining the distribution destination.
When specifying this key, the route key of the BalancerMember directive must be specified at the same time.
No default value exists when the key is omitted.
-
Note
If you do not want a request for a specific path to be sent to the reverse proxy, specify the ProxyPass directive that specifies path name that you do not want to send, before the ProxyPass directive that specifies the URL of a forwarding destination.
- Example:
-
ProxyPass /abc/def/ ! ProxyPass /abc/ http://backend.example.com/
Locations where it can be written
httpsd.conf and <VirtualHost>