When a point of presence (POP) retrieves a resource from the origin server, the origin server returns an HTTP status code. You can configure a cache time-to-live (TTL) for the HTTP status code in the Edge Security Acceleration (ESA) console. When a client requests the same resource, the POP returns the HTTP status code without triggering origin fetch. This reduces loads on the origin server. After a cached HTTP status code expires, requests that trigger the code are redirected to the origin server.
Scenarios
The cache TTL of HTTP status codes is used to specify the period during which caching operations can be performed on the POP when the origin server returns an abnormal HTTP status code.
In normal cases where a POP retrieves the requested resource from the origin server and the origin server returns an HTTP 2xx status code, the resource is cached based on default cache rules.
If the origin server cannot quickly return all HTTP status codes, such as non-HTTP 2xx status codes, and you do not want all requests to be responded by the origin server, you can configure a cache TTL for HTTP status codes to allow POPs to return HTTP status codes. This reduces loads on the origin server.
Example
File A is deleted from the origin server and is not cached on POPs. When clients continue to request the file, all requests for file A are redirected to the origin server. The origin server returns an HTTP 4xx status code for all the requests. This increases loads on the origin server. If you configure a cache TTL for the HTTP 4xx status code, POPs cache the HTTP 4xx status code after the first request for file A is responded by the origin server. During the TTL, when a client requests file A again, the POP returns the HTTP 4xx status code without redirecting the request to the origin server.
Set status code cache TTL
In the ESA console, choose Websites and click the website name you want to manage.
In the left-side navigation pane, choose .
Click Create Rule, and fill in the Rule Name.
In the If Requests Match... area, specify the conditions for matching incoming requests. For more information about how to configure a rule, see Rules.
In the Bypass Cache section, specify whether to bypass cache. For more information, see Bypass cache.
In the Edge Cache TTL section, click Configure.
Click Add next to Status Code Cache TTL, select an HTTP status code, and specify the TTL.
Click OK.