Direct policy hits to the cache instead of the origin
By default, when a request matches a policy, the NetScaler appliance forwards the request either to the origin server directly, or to a load balancing virtual server for the origin, depending on how you have configured cache redirection.
You can change the default behavior so that when a request matches a policy, the request is forwarded to a load balancing virtual server for the cache.
To change the destination for a policy hit to the origin or the cache, use the onPolicyMatch parameter, which specifies where to send requests that match the cache redirection policy.
The valid options are:
- CACHE - Directs all matching requests to the cache.
- ORIGIN - Directs all matching requests to the origin server.
For this option to work, you must select the cacheredirection type as POLICY.
Possible values: CACHE, ORIGIN
Default value: ORIGIN
Change the destination for a policy hit to the origin or the cache by using the CLI
At the command prompt, type the following commands to change the destination for a policy hit and verify the configuration:
- set cr vserver <name> [-onPolicyMatch (ORIGIN | CACHE)] - show cr vserver <name>
> set cr vserver Vserver-CRD-1 -onPolicyMatch CACHE Done > show cr vserver Vserver-CRD-1 Vserver-CRD-1 (*:80) - HTTP Type: CONTENT State: UP ARP:DISABLED Client Idle Timeout: 180 sec Down state flush: ENABLED Disable Primary Vserver On Down : DISABLED Default: Content Precedence: URL Cache: TRANSPARENT On Policy Match: CACHE L2Conn: OFF OriginUSIP: OFF Redirect: POLICY Reuse: ON Via: ON ARP: OFF 1) Cache bypass Policy: bypass-cache-control 2) Cache bypass Policy: Policy-CRD Done
Change the destination for a policy hit to the origin or the cache by using the GUI
- Navigate to Traffic Management > Cache Redirection > Virtual Servers.
- In the details pane, select the virtual server for which you want to change the destination for a policy hit, (for example, Vserver-CRD-1), and then click Open.
- In Configure Virtual Server (Cache Redirection) dialog box, click Advanced tab.
- Select CACHE or ORIGIN from the Redirect To drop-down list.
- Click OK.