Akamai Caching Recommendations
Explore best practices for optimizing your Akamai caching strategy to improve website performance, reliability, and user experience.
Table of Contents
Introduction
This article provides recommendations for optimizing Akamai caching configurations.
Akamai’s CDN caching service acts as a valuable layer of DDoS protection. When an attacker targets static (cacheable) content, the CDN’s caching servers serve it, preventing the attack from reaching its origin and effectively absorbing it. Red Button encourages customers to cache as much content as possible to minimize the attack surface over their services.
This document outlines Red Button’s best practices and up-to-date caching feature recommendations.
Recommended Caching Configurations
Red Button recommends applying a uniform set of caching configurations aligned with Akamai’s best practices and latest features.
Main Objectives:
Increase the overall cache hit ratio.
Serve error codes (3xx, 4xx, 5xx) from Akamai CDN.
Redirect HTTP to HTTPS at the CDN layer.
Note: Some websites may have different caching compatibility based on their hosting services. Specific recommended configurations may not be feasible for all environments.
For in-depth technical details, refer to Appendix A.
Rule Type | Behaviors | Recommended Value | Notes |
---|---|---|---|
Offload Origin | Caching | Set the "Cache-Control" header with a "max-age/s-maxage" value | |
Tiered Distribution | Enable - On | Allows edge servers to retrieve cached content from other edge servers, reducing latency and origin round trips. | |
Validate Entity Tag (ETag) | Enable - On (if applicable) | Ensures content versioning for accurate cache validation. | |
Remove Vary Header | Enable - Off | ||
Cache HTTP Error Responses | Enable - On | Supports response codes: 204, 305, 400, 404, 405, 501, 502, 503, 504, and 505. | |
Cache Prefreshing | Enable - On | Percentage of TTL - 90% | |
Downstream Cacheability | Caching Option | Allow caching | |
Cache Lifetime | Default | ||
Send Headers | Send only Cache-Control | ||
Mark as private | Off | ||
Static Objects (CSS, JS, Fonts, Images, Files, Other) | Caching Option | Cache | |
Force Revalidation of Stale Objects | Serve stale if unable to validate | ||
Redirects | Cache HTTP Temporary Redirects | Enable - On | Supports response codes: 302, 307. |
Chase Redirects | Enable - On | ||
HTML Pages | Caching Option | Cache the content | |
HTTPS | HTTP Strict Transport Security (HSTS) | Enable - On | Covers 301 error code. |
Include all subdomains | V | ||
Redirect all HTTP requests to HTTPS | V | ||
Redirect Status Code | 301 Moved Permanently | ||
Large Files | Large File Optimization (LFO) | Enable - On | |
LFO Type | Cache whole objects only | ||
Max Cacheable File Size | 1.8 GB |
Glossary
Downstream Caching: Specifies caching instructions sent from edge servers to client devices. By default, content is cached for the remaining edge server TTL or the origin caching headers—whichever is smaller. Downstream cacheability settings allow users to override this default.
Chase Redirects: Determines whether edge servers follow redirects from the origin.
Stale Object: An object in the cache with an expired TTL, meaning it may be outdated. Sometimes, serving stale content is preferable to serving no content at all.
Send Headers: Specifies HTTP headers included in responses sent to clients.
Cache Refreshing: Akamai edge servers can refresh objects asynchronously if a request is received within a defined percentage of the TTL (default: 90%). After 90% of the TTL has elapsed, a request triggers an asynchronous "If-Modified-Since" (IMS) request to validate the cached content against the origin.