When I open the dev tool and select Disable Cache, chrome adds Cache-Control: no-cache in request header for all requests.
But if I press ctrl + F5 or click on Empty Cache and hard reload button in chrome, I noticed that for some requests, chrome does not add Cache-Control: no-cache in request header.
How does chrome determine which request to add the header?
Example issue I'm having with 2 requests:
Initial conditions (normal load)
- Request 1 & 2 (request headers): no
Cache-Control- Response 1 & 2 (response headers):
Cache-Control: public,max-age=3600→ both are cached
| Scenario | Request 1 — Request Header | Response 1 — Result | Request 2 — Request Header | Response 2 — Result |
|---|---|---|---|---|
| Baseline (normal load) | (none) | 200 from server; cached (max-age=3600) |
(none) | 200 from server; cached (max-age=3600) |
| Scenario 1: Hard reload (Ctrl+F5) | Cache-Control: no-cache (added by browser?) |
Refetched from server | (none why??) | Loaded from disk cache |
| Scenario 2: Empty cache + hard reload | Cache-Control: no-cache (added by browser?) |
Refetched from server | (none why??) | Refetched from server |
So I'm very confused why browser only add Cache-Control: no-cache in request 1's header but not request 2 when I ctrlF5 or Empty cache and hard reload?
Cache-Control: no-cachewhen "Disable Cache" is checked up.