Open Bug 1787538 Opened 3 years ago Updated 3 years ago

Cachable 404 responses are not cached

Categories

(Core :: Networking: Cache, enhancement, P2)

Firefox 104
x86_64
Windows 10
enhancement

Tracking

()

People

(Reporter: ivan.zderadicka, Unassigned)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Attached image FF-404-caching.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0

Steps to reproduce:

Server return responses with this header:
cache-control: public, max-age=86400

status 200 responses are cached, 404 not

Actual results:

404 responses with cache-control header are not cached
Chrome is caching such responses.

I think there are many valid use cases where caching 404s makes sense. So I think it'll make sense for FF to use same behavior as Chrome.

Expected results:

404 responses with appropriate cache-control header should be cached.

Summary: Casheable 404 responses are not cached → Cachable 404 responses are not cached
Component: Untriaged → Networking: Cache
OS: Unspecified → Windows 10
Product: Firefox → Core
Hardware: Unspecified → x86_64

I think this was changed in bug 1121447.

Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]

Hello Ivan, can you give us a link for any websites where you encounter this issue so we can reproduce this issue on our side ? Thanks in advance.

Flags: needinfo?(ivan.zderadicka)

Hi,

I do not have any public site - but you can easily simulate

Any response that returns something like this

HTTP/1.1 404 Not Found
Server: nginx/1.16.0
Date: Fri, 04 Nov 2022 14:44:35 GMT
Content-Type: text/plain
Content-Length: 9
Connection: keep-alive
cache-control: public, max-age=86400

can be used to test - important is the cache-control header and 404 status - such response is cached in Chrome, but not in Firefox

Flags: needinfo?(ivan.zderadicka)

I havent seen the cache-control header for the 404 status in Firefox at all but I have seen it in Chrome, Based on Comment 1 this might be intended behavior but Ill open it as an Enhancement and maybe someone from our Dev team can take a look.

Status: UNCONFIRMED → NEW
Type: defect → enhancement
Ever confirmed: true

@Rares - thanks,
As I've explained previously caching 404 responses is kind of "grey area" - Chrome does it, but FF does not.
It might be conscious decision on FF side.
What I wanted to explain is that in certain scenarios it makes sense to cache 404 and it should be driven by cache-control header, so that programmers can decide what's best for their application. And it would be nice if main browsers handle this consistently.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: