ETag headers identify whether the version of a resource cached in the browser is the same as the resource at the origin web server. A visitor's browser stores ETags. When a visitor revisits a site, the browser compares each ETag to the one it stored. Matching values cause a 304 Not-Modified HTTP response that indicates the cached resource version is current. Cloudflare supports both strong and weak ETags configured at your origin web server.
Weak ETag headers indicate a cached resource is semantically equivalent to the version on the web server but not necessarily byte-for-byte identical.
Strong ETag headers ensure the resource in browser cache and on the web server are byte-for-byte identical. Use Cache Rules to enable strong ETag headers.
When you enable Respect Strong ETags in a cache rule, Cloudflare will use strong ETag header validation to ensure that resources in the Cloudflare cache and on the origin server are byte-for-byte identical.
However, in some situations Cloudflare will convert strong ETags to weak ETags. For example, given the following conditions:
- Respect Strong ETags is enabled
- Brotli compression is enabled
- The origin server's response includes an
etag: "foobar"strong ETag header
The Cloudflare network will take the following actions, depending on the visitor's accept-encoding header and the compression used in the origin server's response:
accept-encodingheader from visitor |
Compression used in origin server response | Cloudflare actions |
|---|---|---|
gzip, br |
GZIP | Return GZIP-compressed response to visitor with strong ETag header: etag: "foobar". |
gzip, br |
Brotli | Return Brotli-compressed response to visitor with strong ETag header: etag: "foobar". |
br |
GZIP |