HTTP Header

ETag

Last updated: April 2026

An ETag (Entity Tag) is a cache validator. The server assigns a unique token to each version of a resource. Browsers send it back on subsequent requests so the server can return 304 Not Modified instead of resending the full resource.

How ETags work

# 1. First request โ€” server sends ETag
HTTP/1.1 200 OK
ETag: "abc123"
Cache-Control: max-age=3600

# 2. Cache expires โ€” browser sends ETag back
GET /api/data
If-None-Match: "abc123"

# 3a. Resource unchanged โ€” 304 (no body = faster)
HTTP/1.1 304 Not Modified

# 3b. Resource changed โ€” new ETag
HTTP/1.1 200 OK
ETag: "def456"

Nginx ETag configuration

# ETags are enabled by default in Nginx for static files
# Disable if needed (e.g. load balancers generating different ETags)
etag off;

Weak vs strong ETags

ETag: "abc123"    # strong โ€” byte-for-byte identical
ETag: W/"abc123"  # weak โ€” semantically equivalent (gzip variants OK)

ETag vs Last-Modified

# ETag โ€” hash-based (precise)
ETag: "abc123"
If-None-Match: "abc123"

# Last-Modified โ€” timestamp-based (1 second precision)
Last-Modified: Sun, 12 Apr 2026 10:00:00 GMT
If-Modified-Since: Sun, 12 Apr 2026 10:00:00 GMT
📚 HttpFixer Glossary โ€” all terms โ†’