About Caching Decisions Oracle Fusion Middleware Online Documentation Library

6-4 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache

6.4 Introduction to Creating Caching Rules

When you decide to create a caching rule for an object, 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. After you determine that choice, you configure general attributes for the rule: ■ Information about the rule, such as its name, description, site, and whether or not to enable the rule ■ Actions for Oracle Web Cache to take when an incoming request matches a rule ■ Match criteria for Oracle Web Cache to locate the matching rule for incoming requests. Select to base the 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. Matching the evaluation on the MIME type makes sense when entering URL expressions becomes cumbersome. For example, the following shows a complicated URL expression for various image types: \.gif|jpe?g|png|bmp Instead, you can select the MIME Type option, select Starts with, and enter the following string in the expression field: image For most match evaluations, select the Starts with option, because the Content-Type response header typically has additional content parameter values. You can also enter a list in the expression field, separated by commas. Continuing with the same example, if you want to match only GIF or JPEG responses, enter the following string in the expression field: imagegif, imagejpeg After you create caching rules, you order the priority of caching rules. Higher priority rules are matched first. Oracle Web Cache gives site-specific caching rules a higher priority than the global caching rules. When ordering caching rules for cacheable and non-cacheable objects, give the non-cacheable objects a higher priority than the cacheable objects. In the rules shown in Table 6–1 , rule 2 caches objects of the URL that use the GET and GET with query string methods, and rule 3 caches objects of the URL that use the POST method and a POST body matching action=search. If the order were reversed, all objects starting with ceccstage?ecaction=ecpassthru would be cached, including ceccstage?ecaction=ecpassthru2. Caching and Compressing Content 6-5 For more information about specifying general attributes for caching rules and specifying priority, see Section 6.8.1

6.5 Introduction to Configuring Advanced Settings

In addition to general attributes, you can configure advanced settings, as described in the following topics: ■ Section 6.5.1, Caching for Objects with Multiple Versions ■ Section 6.5.2, Caching for Objects with Embedded URL and POST Body Parameters ■ Section 6.5.3, Caching Error Responses ■ Section 6.5.4, Caching for Objects with Sessions ■ Section 6.5.5, Caching for Objects with Session-Encoded URLs

6.5.1 Caching for Objects with Multiple Versions

Some pages have multiple versions, enabling categorization. Figure 6–1 shows the same object, https:oraclestore.oracle.comOA_ HTMLibeCCtpItmDspRte.jsp?item=293017section=11538, with different prices for customers and internal Oracle employees. While customers pass a cookie name and value of ec-400-id-acctcat=WALKIN, employees pass a cookie name and value of ec-400-id-acctcat=INTERNAL. Table 6–1 Example of Priority for Different HTTP Methods Priority Match Criteria HTTP Methods POST Body Expression Action 1 URL Expression: Regular Expression: ceccstage\?ecaction=ecpassthru2 Path Prefix: ceccstage\?ecaction=ecpassthru2 GET and GET with query string NA Dont Cache 2 URL Expression: Regular Expression: ceccstage\?ecaction=ecpassthru. Path Prefix: ceccstage\?ecaction=ecpassthru GET and GET with query string NA Cache 3 URL Expression: Regular Expression: ceccstage\?ecaction=ecpassthru. Path Prefix: ceccstage\?ecaction=ecpassthru POST Body Expression action=search Cache 4 MIME Type: image GET and GET with query string NA Cache 6-6 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache Figure 6–1 Multiple-Version Object You can configure Oracle Web Cache to recognize and cache multiple-version pages by using the: ■ Values of the cookie for the page ■ HTTP request headers for the page For those objects that use a cookie sometimes referred to as a category cookie , configure caching rules that specify the cookie name and whether to cache versions of the object that do not use the cookie. When a client sends an initial request for a multiple-version object, Oracle Web Cache passes the request to the origin server. In its response, the origin server includes a Set-Cookie response-header with the category cookie and its value: Set-Cookie:cookie=value Oracle Web Cache does not cache this initial response. Upon receiving the Set-Cookie response-header field, the client stores the cookie in memory. With its