Caching for Objects with Session-Encoded URLs

Caching and Compressing Content 6-11 a session cookie, embedded URL parameter, or POST body parameter. If the request does not contain a session cookie or embedded URL parameter, you can configure Oracle Web Cache to substitute the session information in the session-encoded URLs with a configurable default string. For configuration details, see Section 6.8.7 .

6.6 Basic Tasks for Configuring and Monitoring Caching Rules

The following provides a summary of the steps required to cache and monitor objects: 1. Configure expiration policies. See Section 6.7 . 2. Create sites for which Oracle Web Cache manages requests. See Section 2.11.3 and Section 2.11.4 . 3. Configure general settings for a caching rule. See Section 6.8.1 . 4. Configure advanced settings for a caching rule: ■ Configure cookie and HTTP request-header fields for rules supporting multiple-version objects. Section 6.8.2 . ■ Configure Oracle Web Cache to ignore the value of embedded URL or POST body parameters. See Section 6.8.3 . ■ Configure error responses for rules. See Section 6.8.5 . ■ Configure session settings for rules. See Section 6.8.6 . ■ Configure support for session-encoded URLs. See Section 6.8.7 . 5. Restart Oracle Web Cache to apply caching rule. See Section 2.13 . 6. Monitor statistics for caching rules. See Section 6.9 . 7. View popular requests. See Section 8.2 .

6.7 Configuring Expiration Policies

Prior to creating a caching rule, you create expiration policies. Later, when you create caching rules, you specify an expiration policy to apply with the caching rule. You can create expiration policies that specify when to expire objects in the cache. In addition, you can specify how long objects can reside in the cache after they have expired. When an object expires, Oracle Web Cache removes it either immediately or as permitted by origin server capacity up to a maximum time limit. To create an expiration policy: 1. Navigate to the Web Cache Home page in Fusion Middleware Control. See Section 2.6.2 .

2. From the Web Cache menu, select Administration and then Expiration.

The Expiration Policies page displays.

3. Click Create.

The Create Expiration Policy dialog displays.

4. In the Objects Expire section, specify when to expire objects by selecting an

option: ■ As per HTTP Expires Header: Select this option to respect the HTTP Cache-Control or Expires response-header fields. This is the default. 6-12 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache ■ After Cache Entry: Select this option to base expiration on when the objects entered the cache. Enter the time to expire the objects in the Time Limit field. ■ After Creation: Select this option to base expiration on when the objects were created, as indicated by the origin server. Enter the time to expire the objects in the Time Limit field.

5. In the Action On Expired Objects section, specify how you want Oracle Web

Cache to process objects after they have expired: ■ Remove Immediately: Oracle Web Cache marks objects as invalid and then removes them immediately. An object is refreshed from the origin server when the cache receives the next request for it. ■ Refresh on Demand as Origin Server Permits: Oracle Web Cache marks objects as stale and then refreshes them based on origin server capacity. Oracle Web Cache may serve the stale content when the origin server is heavily loaded. Enter the maximum time in which the objects can reside in the cache and be served stale in the Time Limit field.

6. Click OK to apply changes.

7. Restart Oracle Web Cache. See Section 2.13 .

6.8 Configuring and Monitoring Caching Rules

This section describes how to configure caching rules for Oracle Web Cache. It includes the following topics: ■ Section 6.8.1, Configuring General Rule Settings ■ Section 6.8.2, Configuring Settings for Rules with Multiple Versions of the Same Object ■ Section 6.8.3, Excluding the Value of Embedded URL or POST Body Parameters ■ Section 6.8.4, Recognizing Similar Browser Types for Multiple-Version Objects Containing HTTP Request Headers ■ Section 6.8.5, Configuring Error Responses for Rules ■ Section 6.8.6, Configuring Session Caching Rules ■ Section 6.8.7, Configuring Support for Session-Encoded URLs ■ Section 6.8.8, Configuring Rules for Popular Pages with Session Establishment

6.8.1 Configuring General Rule Settings

Before you create a caching rule, determine first whether the rule for the object is for a specific site or global to all sites. Oracle Web Cache gives site-specific caching rules a higher priority than the global rules. For more information about caching decisions, see Section 6.3 . To create a caching rule: 1. Navigate to the Web Cache Home page in Fusion Middleware Control. See Section 2.6.2 .

2. From the Web Cache menu, select Administration and then Caching Rules.

The Caching Rules page displays. 3. Create a new rule. Caching and Compressing Content 6-13

a. From Site Specific Caching Rules or Global Caching Rules section, click

Create . The Create Caching Rule page displays with the General tab in view. b. Complete the elements using the descriptions in Table 6–4 . When completing the elements, in the Match Criteria section, select to base match evaluation on the request URL expression, the response MIME type, or both criteria. If you do not select a match criteria, Oracle Web Cache matches the rule to all URLs and all MIME types. If you find entering URL expressions is cumbersome for your rules, select the MIME Type option in the Match Criteria section. See Section 6.4 for further information about using the MIME Type option in place of complicated URL expressions.

c. Click OK to apply changes and return to the Caching Rules page. It is not

necessary to click Apply in the Create Caching Rule page to apply this change. Notice the caching rule is added to the Site Specific Caching Rules or Global Caching Rules table. 4. Repeat Step 3 for each additional rule.

5. Use the Move Up and Move Down icons to change the order in which the rules

are matched against requests. The order of the rules is important. Oracle Web Cache matches higher priority rules first.

6. Click Apply to apply the move change.

7. In the Caching Rules page, click Enable to enable rules.

If you do not click Enable, Oracle Web Cache ignores any the settings for the rule. 8. Restart Oracle Web Cache. See Section 2.13 . Table 6–4 Caching Rules - General Page Element Description Name Enter a string that uniquely identifies the caching rule. Description Enter a descriptive comment about the caching rule. Enabled Select to enable the caching rule; deselect to disable the caching rule temporarily without losing the rule definition. Site Displays the site for which to apply this rule. If you do not see the site required, create one, following the procedure in Section 2.11.3 . Cache Select this option to instruct Oracle Web Cache to cache content; deslect this option to instruct Oracle Web Cache to forward requests to the origin server and to not cache the content. Expiration From the list, select an expiration policy to apply to the objects. If you do not see an expiration policy suitable for the objects, click the Expiration Policies link.