5 ms·
You're right about being safe rather than unecessarily fancy. A lot of codes get real usage though. CDNs use ETags extensively to save bandwidth. It can save a
by alganet 3y ago
You're right about being safe rather than unecessarily fancy.
A lot of codes get real usage though. CDNs use ETags extensively to save bandwidth. It can save a lot of server time.
- https://developers.cloudflare.com/cache/reference/etag-headers/
- https://techdocs.akamai.com/property-mgr/docs/val-entity-tag
Varnish, HAProxy, Apache mod-proxy, nginx all can do similar things. Some of them can do this even if you always return 200 (by having rewrite rules and so on). It is often better to leave this kind of work to some upper abstract layer. Some of thse codes are only applicable in a layered system (502, for example, often seen when nginx can't reach a backend application), so they seem useless to developers, but they're not.
For APIs, other stuff uses those codes. Tools like DataDog and NewRelic will get better if you use generic 400 and generic 500 for client and server errors respectively. You can make them work with 200s and a little configuration though, but it's extra work.
If you never needed any of this, it's better not to use it.
- jerf 3y agoI should indeed have clarified that the browser web has a much richer set of headers and response codes in use, and they are truly useful, and anyone serving web pages at scale should indeed learn about them. IIRC it's still about 1/3rd to 1/4th of the nominally defined HTTP response codes that are useful, but it's still something. The non-browser web, they approach useless. Which I'm not happy about and not celebrating or advocating for. It's just how it is.