Previous Topic: Virtual Host Settings in the server.conf File

Next Topic: Preserve the HOST Header File

Setting Virtual Host Cookie Path and Domain to the Correct URI

The virtual host configuration in the server.conf file includes the enablerewritecookiepath and enablerewritecookiedomain parameters, which you can use to manage cookies generated by a destination server that sits behind the SPS. When the SPS receives a request from a client, the SPS authenticates the user and directs the client to the requested destination server. The destination server generates a cookie that it places in the browser, then the SPS sends the user back the client response with the cookie. After receiving the response from the SPS, the client stores the cookie.

When the client sends a subsequent request, the browser retrieves the stored cookie associated with the URL. In some cases, the destination server can possibly have set the cookie path to its own resource URI and not to the URI of the initial request. As a result, when the client sends the subsequent request, the browser contains the wrong cookie or does not even have a cookie. The request is received at the destination server with the wrong cookie or with no cookie at all.

To help ensure that the correct cookie is set in the browser, you can configure the SPS to rewrite the cookie path and cookie domain. The destination server sets the cookie path and cookie domain to the URI of the resource on the SPS server. The client can send the correct cookie back with subsequent requests to SPS.

The two parameters operate as follows:

enablerewritecookiepath

Instructs the SPS to rewrite the cookie path to the URI of the initial request from the URI set by the server that sits behind the proxy.

Default: no

enablerewritecookiedomain

Instructs the SPS to rewrite the cookie domain from the domain set by the server sitting behind the proxy to the domain of the initial request.

Default: no

Example

The client requests an SPS resource http://mysps.ca.com/basic/test/page0.html. With the enablerewritecookiepath set to yes, the cookie path is rewritten to /basic/test before the browser is sent back to the client. This cookie is rewritten regardless of the cookie path that was originally in the cookie received by SPS from the destination server.

To rewrite backend cookie paths and domain

  1. Open the server.conf file in a text editor.
  2. Set one or both of the following parameters to yes:
  3. Save the file.
  4. Restart the SPS.