Mastering Nginx

(Ron) #1
Chapter 4

[ 67 ]

In both of these cases, the URI part of the proxy_pass directive is not relevant,


so the configuration would be complete without it:


location ~ ^/local {

proxy_pass http://localhost:8080;
}

location / {

rewrite /(.*)$ /index.php?page=$1 break;

proxy_pass http://localhost:8080;
}

The proxy module


The following table summarizes some of the commonly used directives in the


proxy module:


Table: Proxy module directives

Directive Explanation
proxy_connect_timeout The maximum amount of time NGINX
will wait for its connection to be
accepted when making a request to an
upstream server.
proxy_cookie_domain Replaces the domain attribute of the
Set-Cookie header from the upstream
server; the domain to be replaced can
either be a string or a regular expression,
or reference a variable.
proxy_cookie_path Replaces the path attribute of the Set-
Cookie header from the upstream
server; the path to be replaced can either
be a string or a regular expression, or
reference a variable.
proxy_headers_hash_bucket_size The maximum size of header names.
proxy_headers_hash_max_size The total size of headers received from
the upstream server.
proxy_hide_header A list of header fields that should not be
passed on to the client.
Free download pdf