[ADP-143] Expires
Guidance
- SHOULD NOT use
Expiresheader as it is not commonly recommended in modern API design.
Design Considerations
- The
Expiresheader can be manipulated by changing the system time, potentially invalidating its intended purpose. - Browsers typically ignore the
Expiresheader ifmax-ageis set (as a directive inCache-Control). - The
Expiresheader may affect the behavior ofLast-Modified.
Best Practices
- Use
Cache-Controlheader withmax-agedirective instead ofExpiresfor more precise and reliable cache control. - If
Expiresmust be used, combine it withCache-Controlto ensure consistent behavior across different clients. - Always consider the security implications of caching, especially for sensitive or frequently updated resources.
Implementation Example
http
Cache-Control: max-age=3600, public