How to bypass object caching for specific URLs
search cancel

How to bypass object caching for specific URLs

book

Article ID: 166322

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

Object caching causes unexpected behavior for some web sites, or causes sites to display stale content.

Resolution

To prevent the transmission of stale content or other issues caused by object caching, you can use either cache(no) or bypass_cache(yes) in content policy language (CPL). For a comparison of cache(no) and bypass_cache(yes), see The differences between cache(no) and bypass_cache(yes).

This sample provides instructions for disabling object caching for specific URLs by adding a policy rule in the Web Access Layer.

  1. In the Management Console, select Configuration > Policy > Visual Policy Manger, and then click Launch.
  2. From the Visual Policy Manager (VPM) dialog box, select Policy > Add Web Access Layer. The Add New Layer dialog box appears.
  3. In the Add New Layer dialog box, name the layer to reflect the purpose of the layer, such as "Web Access Layer (bypass cache)," then click OK.
  4. Right click the Destination field and select Set from the drop-down list.
  5. In the Set Destination Object dialog box, click New > Request URL, and enter the URL you want to exclude from the cache. Click Add, then OK.
  6. Right click on Action and select Set > Bypass Cache.  Then, click OK.
  7. Click Install policy to apply the new policy.

To use CPL code for the same policy rules, add the following CPL code in the local policy file or in a VPM CPL Policy Layer:

    <Proxy>
   url.domain=<url> bypass_cache(yes)

In the example above, <urlis the URL you want to exclude from caching.

 

Additionally, here is a CPL script to bypass cache per exception basis:

;############ Bypass Cache on Exception ############
; This script utilizes the "bypass_cache" syntax
; to effectively prevent the ProxySG appliance from 
; even checking to see if the object is in cache, 
; meaning any existing cached copy will not be touched 
; and can still be served to other clients which run 
; with bypass_cache(no) policy.

<Proxy>
   condition=Bypass_Cache_On_Exception bypass_cache(yes)

Define condition Bypass_Cache_On_Exception
url.domain=test.com
url.domain=www.test2.com
end condition Bypass_Cache_On_Exception

; Note: Enter additional sites into the condition;
; One site per CPL line
;########## END Bypass Cache on Exception ##########