Commit 54c886f

Eric Bower  ·  2026-04-20 19:39:46 -0400 EDT
parent 0a4c670
fix(httpcache): verified heuristically cachable status codes
1 files changed,  +9, -7
+9, -7
......@@ -434,15 +434,17 @@ func isResponseCachable(r *http.Request, resp *responseWriter) error {
434434 return nil
435435 }
436436
437-// isCacheableStatusCode checks if the status code is cacheable per RFC 9110 Section 15.1-2
438-// RFC 9110 15.1-2: 200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, and 501.
437+// RFC 9110 15.1-2: Heuristically cachable status codes
438+// 200, 203, 204,
439+// 206, 300, 301,
440+// 308, 404, 405,
441+// 410, 414, 501.
439442 func isCacheableStatusCode(code int) bool {
440443 switch code {
441- case http.StatusOK, http.StatusMultipleChoices, http.StatusMovedPermanently, http.StatusFound,
442- http.StatusSeeOther, http.StatusUseProxy, http.StatusTemporaryRedirect,
443- http.StatusPermanentRedirect, http.StatusPartialContent, http.StatusMultiStatus,
444- http.StatusAlreadyReported, http.StatusIMUsed, http.StatusNotImplemented, http.StatusBadGateway,
445- http.StatusServiceUnavailable, http.StatusGatewayTimeout, http.StatusHTTPVersionNotSupported:
444+ case http.StatusOK, http.StatusNonAuthoritativeInfo, http.StatusNoContent,
445+ http.StatusPartialContent, http.StatusMultipleChoices, http.StatusMovedPermanently,
446+ http.StatusPermanentRedirect, http.StatusNotFound, http.StatusMethodNotAllowed,
447+ http.StatusGone, http.StatusRequestURITooLong, http.StatusNotImplemented:
446448 return true
447449 default:
448450 return false