Skip to content

Commit 1208623

Browse files
committed
fix(es): add cache troubleshooting
1 parent 70ce45c commit 1208623

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

pages/edge-services/how-to/configure-cache.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,8 @@ For Object Storage bucket origins, the following example call to the S3 API upda
121121

122122
3. Click **Disable cache**.
123123

124-
Your cache is purged and disabled. Edge Services will now serve content by fetching it from your origin (Object Storage bucket or Load Balancer) directly. If you reenable your cache at a later point, you will begin with an empty cache.
124+
Your cache is purged and disabled. Edge Services will now serve content by fetching it from your origin (Object Storage bucket or Load Balancer) directly. If you reenable your cache at a later point, you will begin with an empty cache.
125+
126+
## Troubleshooting cache problems
127+
128+
See our [dedicated documentation](/edge-services/troubleshooting/cache-problems/) on resolving unexpected caching behavior with Edge Services.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: I am experiencing problems with my Edge Services cache
3+
description: Troubleshoot issues that may arise with caching on your Edge Services pipeline.
4+
tags: edge-services cache cookies load-balancer
5+
dates:
6+
validation: 2025-11-05
7+
posted: 2025-11-05
8+
---
9+
10+
You may experience unexpected behavior with caching on your Edge Services pipeline.
11+
12+
This page helps you resolve common problems.
13+
14+
## Some assets are not being correctly cached by Edge Services.
15+
16+
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, 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.
17+
18+
### Cause
19+
20+
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.
21+
22+
### Solutions
23+
24+
Use the [Edge Services API](https://www.scaleway.com/en/developers/api/edge-services/#path-cache-stages-create-cache-stage) to override the default behavior by setting `include_cookies` to `true` in your cache stage.
25+
26+
This tells Edge Services to cache responses even if cookies are present in the request.
27+
28+
You can verify cache behavior by using `curl -X GET -I` to test as follows:
29+
30+
```
31+
curl -X GET -I "https://your-edge-service.com/asset.jpg"
32+
```
33+
34+
Check the X-Cache header in the response:
35+
36+
- `X-Cache: hit-fresh`: the cache is working.
37+
- `X-Cache: miss`: the cache was bypassed.
38+
39+
<Message type="tip">
40+
Be cautious when using `curl` to test. `curl -I` uses the HEAD method by default, which can mislead you during troubleshooting. Use `curl -X GET -I` for more accurate testing.
41+
</Message>
42+
43+
Use a cookie-free subdomain for static assets. This prevents cookies from being sent with requests for images, CSS, or JS.

pages/edge-services/troubleshooting/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ productIcon: EdgeServicesProductIcon
6161
<LinksList>
6262
- [I am experiencing problems with my Edge Services certificate](/edge-services/troubleshooting/certificate-errors)
6363
- [I am experiencing problems with my Edge Services CNAME record](/edge-services/troubleshooting/cname-errors)
64+
- [I am experiencing problems with my Edge Services cache](/edge-services/troubleshooting/cache-problems/)
6465
</LinksList>

0 commit comments

Comments
 (0)