1001Ferramentas
🏷️Dev

ETag Weak vs Strong

Classifica um ETag como weak (W/"...") ou strong. Weak é igualdade semântica, strong é byte-a-byte.

Tipo

What that W/ prefix on an ETag means

You are chasing a 304 that never fires, or one that fires when it should not, and you noticed some ETags come back as "a1b2c3" while others come back as W/"a1b2c3". The difference is not cosmetic: it decides which conditional requests the server can honor. Paste the value from the header and the page tells you whether that ETag is strong or weak, or whether the format is off spec.

The rule comes from RFC 9110. An ETag is a quoted string, optionally prefixed with W/ using a capital W, and that prefix is case sensitive. Strong means byte-for-byte equality. Weak means the resource is semantically the same even though the bytes changed. That is exactly why compression layers tend to downgrade a strong ETag to a weak one: the content is unchanged, the representation is not.

The practical consequence shows up in conditional requests. If-None-Match, the ordinary 304 path, uses weak comparison and accepts either kind. If-Range and If-Match require strong comparison, so with a weak ETag a resumed download starts over instead of continuing where it stopped. If you derive the ETag from a hash of the bytes you send, go strong; if you derive it from a row version in the database, weak is the honest choice. The check reads only the pasted text.

Frequently asked questions

Can I write the prefix as lowercase w/?
No. RFC 9110 defines the weak indicator as a capital W followed by a slash. Lowercase makes it an invalid entity-tag, and the page flags it as a bad format.
Does it make sense to send both ETag and Last-Modified?
Yes, and it is common. A client may send If-None-Match and If-Modified-Since together; when both are present the server decides on the ETag, which is more precise.
Does the tool compute the ETag for my file?
No. It classifies a value you already have. Generating the ETag is the server's job, usually from a hash of the body or from a resource version.

Related Tools