api caching ai_generated true

If-None-Match always misses — weak vs strong ETag comparison

ID: api/etag-weak-vs-strong-comparison

Also available as: JSON · Markdown
82%Fix Rate
85%Confidence
4Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Server returns weak ETag W/ but client uses strong comparison, so conditional requests always miss.

generic

Workarounds

  1. 88% success Use If-None-Match with weak comparison as specified in RFC 7232
    Pass the full W/ value as-is

    Sources: https://www.rfc-editor.org/rfc/rfc7232#section-3.2

  2. 80% success Request strong ETag from server via Cache-Control or API option
    Some APIs support ?strong_etag=true

    Sources: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag

Dead Ends

Common approaches that don't work:

  1. Strip W/ prefix before comparing 85% fail

    Stripping W/ converts a weak ETag to strong; they have different semantics per RFC 7232

  2. Use If-Match instead of If-None-Match with weak ETags 90% fail

    If-Match requires strong comparison by spec; weak ETags will always fail