As stated in the title, which HTTP status codes are acceptable to cache as a browser? I did a quick search and did not find an authoritative answer.
Originally I thought it may only be 200
OK responses, but I couldn't find any evidence to support that thought.
According to RFC7234 it is also allowed to cache responses that deliver another code than 200 (OK):
So it's up to the browser developer what he wants to cache and what not.
Short answer
According to the RFC 7231, the current reference for content and semantics of the HTTP/1.1 protocol, the following HTTP status codes are defined as cacheable unless otherwise indicated by the method definition or explicit cache controls:
200
OK203
Non-Authoritative Information204
No Content206
Partial Content300
Multiple Choices301
Moved Permanently404
Not Found405
Method Not Allowed410
Gone414
URI Too Long501
Not ImplementedLong answer
The RFC 7231 states the following regarding the HTTP status codes that are cacheable by default:
Once the HTTP status codes are extensible, recipient must note cache a response with an unrecognized status code:
The cache also depends on the HTTP method:
Regarding the
POST
method, there's an important detail:For more details, check the definition of each method.
Additional resources