Unable to cache error pages

Hi there,

To prevent origin being jam when error increase, I hope to set 1 hour cache for 403 and 404 status code and did so. But when testing, the Server-Timing header told me TCP_MISS and no Age or X-Cache: HIT even I refreshed for times.

Configuration about this part is shown below:

 {
        "caching": {
          "max_age": {
            "200": "30d",
            "403": "1h",
            "404": "1h"
          },
          "client_max_age": "30d",
          "default_internal_max_age": {
            "200": "30d",
            "403": "1h",
            "404": "1h"
          },
          "cache_control_header_treatment": "overwrite"
        }
      }

Based on the information provided in the Edgio documentation, it appears that you have set up a custom caching policy to cache 403 and 404 HTTP status codes for 1 hour. However, you are experiencing a TCP_MISS status code, which indicates that a cached version of the requested asset was not found on the POP closest to the client.

The Server-Timing header and the lack of Age or X-Cache: HIT headers suggest that the asset is not being served from the cache as expected. There are several factors that could be causing this behavior:

  1. Cache Key Configuration: Ensure that the cache key is correctly configured to match the requests that should be served with the cached 403 and 404 responses. If the cache key does not match, the request will result in a cache miss. Edgio uses the cache key to identify whether content has been cached for a request (Cache Management).

  2. Cache Directives: Verify that the origin server’s response does not include cache directives that prevent caching, such as Cache-Control: no-store, Cache-Control: no-cache, or Pragma: no-cache. These directives can prevent caching even if a custom caching policy is defined (Features Reference - Ignore Origin No Cache).

  3. Cache Invalidation (Purging): Check if there have been any recent cache purges that could have removed the cached responses for 403 and 404 status codes, resulting in a cache miss for subsequent requests (Cache Hit Ratio Optimization).

  4. Configuration Propagation: After updating the caching configuration, ensure that the changes have fully propagated across all Edgio POPs. Configuration changes may take some time to take effect across the entire network.

  5. Rules Configuration: Review any rules that may affect caching behavior to ensure they are not inadvertently causing the requests to bypass the cache or be treated differently than expected (Troubleshooting - Cache Miss).

  6. Testing Methodology: Ensure that the testing methodology is sound and that the requests being tested should indeed result in a cache hit based on the current configuration.

If you have verified all the above points and the issue persists, it may be necessary to review the detailed request and response headers to diagnose the problem further. You may also want to consult Edgio’s support or documentation for additional troubleshooting steps.

References:


Edgio Answers may provide inaccurate information and should be verified. Consult our official documentation for more information.

In addition to defining a caching policy for non-200 responses, negative caching requires enabling the Cacheable Status Codes (cacheable_status_codes) and Ignore Origin No Cache (ignore_origin_no_cache) features.

As a side note, you may safely remove the Set Default Internal Max Age (default_internal_max_age) feature from your rule, since you are already setting max_age within that rule.