I am experiencing problems with my Edge Services cache
You may experience unexpected behavior with caching on your Edge Services pipeline.
This page helps you resolve common problems.
Some assets are not being correctly cached by Edge Services.
You may find that even though your application includes proper cache headers (e.g., Cache-Control: max-age=...) and is configured behind a Load Balancer with an Edge Services pipeline where caching is activated, static assets like images are not being cached. This can result in repeated X-Cache: miss responses, occasional 502 errors, and a weak cache hit:miss ratio, despite the assets being successfully served.
Cause
The issue often stems from unintended cache bypasses caused by cookies in client requests. For security reasons, Edge Services blocks caching for requests with cookies. This means the cache server bypasses the origin's Cache-control header when the client is using cookies for image requests, for example.
Solutions
Use the Edge Services API to override the default behavior by setting include_cookies to true in your cache stage.
This tells Edge Services to cache responses even if cookies are present in the request.
You can verify cache behavior by using curl -X GET -I to test as follows:
curl -X GET -I "https://your-edge-service.com/asset.jpg"Check the X-Cache header in the response:
X-Cache: hit-fresh: the cache is working.X-Cache: miss: the cache was bypassed.
Use a cookie-free subdomain for static assets. This prevents cookies from being sent with requests for images, CSS, or JS.