Hitachi

uCosminexus Application Server HTTP Server User Guide


4.7.2 How to set directives

The following example describes the settings for each directive that sets the reverse proxy.

Each address is as follows:

Reverse proxy: www.example.com

Backend server: backend.example.com

Organization of this subsection

(1) Reallocating the request URL and the request header

If you set the ProxyPass directive as shown below, the request http://www.example.com/news/oct-2001 received from client changes to the request http://backend.example.com/oct-2001:

ProxyPass /news/ http://backend.example.com/

The Host:Header is reallocated from "Host:www.example.com" to "Host:backend.example.com". After that, the reverse proxy sends the response from the backend server to the client.

(2) Reallocating the response header

If a Redirect directive is executed from a backend server and the directive uses an image map or contains a directory request that does not end with a forward slash (/), the Location header in the backend server response will contain the backend server address. If the response is sent to the client as is, the client will request a redirect from the backend server directly, instead of from the reverse proxy. As a result, you must specify the ProxyPassReverse directive as follows, so that the redirect request also passes through the reverse proxy:

ProxyPassReverse /news/ http://backend.example.com/

The location header is changed to the reverse proxy address.

(3) Reassigning the Set-Cookie header

The domain name and path name are sometimes placed in a Set-Cookie header that is returned to the client from the backend server. By doing so, cookies are sent by the client only when the request matches the domain name and the path name in the Set-Cookie header.

Examples of when the Set-Cookie header is reassigned and when the Set-Cookie header is not reassigned are explained below.