Can a 500 Internal Server Error response be cached by the browser?

When debugging a production problem, we found that GET requests to the URL were returned 500 Internal Server Errorfor one user, but returned 200 OKfor everyone else. It turned out that 500 of the cache is being served, but any attempt to reproduce this error was unsuccessful.

My question is: is it possible for the error response to be cached by the browser? If so, which browsers support it and which cache headers will I need to replicate it?

My intuition is that the answer to the error should not be cached, because you will be denied service, even if the error is fixed. Based On Which HTTP Status Codes Are Cacheable? it also seems that 500 should not be cached at all. Is the caching policy consistently implemented in browsers?

+5
source share
1 answer

A 500 Internal Server Errorspecified is not cached by default . For reference, see Section 6.1 of RFC 7231 and Section 6.6.1 500 Internal RFC 7231 Server Error . If 500 will be cached by default, the specification will define this explicitly.

, , , 500 , 3 RFC 7234 , :

, ;

, - 500.

500, public Cache-Control.

+1

Source: https://habr.com/ru/post/1657531/


All Articles