Enabling Caching Proxy to cache multiple variants of a resource (URI)
 Technote (troubleshooting)
 
Problem(Abstract)
There are two new directives that enable the Caching Proxy (Edge Component) to cache and retrieve multiple variants of a resource (URI) based on the HTTP Vary header and Cookie header.
 
Cause
Two new Caching Proxy directives were introduced, but not documented, in the following versions of IBM® WebSphere® Application Server Edge Components:
  • Version 6.0.0.1 (or higher)
  • Version 5.1.0.7 (or higher)
  • Version 5.0.2.30 (or higher)
 
Resolving the problem
The following new directives allow Caching Proxy to cache more than one variant of a resource (URI) based on either the HTTP Vary header or Cookie header, or both:

SupportVaryHeader Off | On (default is Off)

When the SupportVaryHeader directive is enabled, the proxy forms a cache ID based on the URI and the selected header values in the client request.

The names of the selected headers are specified in the Vary header sent in a prior response from the server. If the server changes the set of selected header names for a resource, all the previous cached objects for the resource are removed from the proxy's cache.

RegisterCacheIdTransformer Cookie cookie-name

The cookie-name is the name in the Cookie header in the clients request.

Note: If cookies are disabled on the client browsers, clients can access the same cached object.

When either or both directives are enabled, the proxy creates an internal Cache ID transformer based on the Vary header from the server and the client's request header. In this way, the proxy can generate unique cache identifiers for different request and response pairs, even if the requested URIs are the same.

The cached objects of the same URI have their own default lifetime in the cache, depending on the Expire, Cache-Control headers in the requests/responses, or other configuration settings. If the Dynacache plug-in is used, all the multiple presentations associated to the same URI become invalid together in the proxy's cache.

Example

The directives are enabled and configured in ibmproxy.conf as follows:

#################################
SupportVaryHeader On
RegisterCacheIdTransformer Cookie UserGroup
#################################

Client Guest accesses the proxy server with the URI http://www.dot.com/group.jpg and the following request/response:

GET /group.jpg HTTP/1.1
Host: www.dot.com
Cookie: UserGroup=Guest
Accept-Language: en_US

HTTP/1.1 200
Server: my-server
Vary: Accept-Language
.........

Next, client Admin accesses the proxy server with the same URI
http://www.dot.com/group.jpg and the following request/response:

GET /group.jpg HTTP/1.1
Host: www.dot.com
Cookie: UserGroup=Admin
Accept-Language: fr_FR

HTTP/1.1 200
Server: my-server
Vary: Accept-Language
.......

As a result, if the responses can be cached, the proxy server generates two different cache IDs:
  1. CacheID(URI, "Guest", "en_US")
  2. CacheID(URI, "Admin", "fr_FR")

The proxy server stores two different variants of the response from the server in the cache.

Subsequently, when any client requests the resource (.../group.jpg), with either combination of language preference and usergroup values, the proxy retrieves the appropriate variant of the resource from the cache and serves it.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
Historical Number
241381
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Edge Component
Operating system(s): Windows
Software version: 6.0.1
Software edition:
Reference #: 1197853
IBM Group: Software Group
Modified date: May 29, 2008