httpfirefoxhttp-headersprotocol-buffersetag

Why does firefox respect HTTP eTag header for json but not for protobuf


I have a webserver that returns both json and pbf. I am using etag to allow caching. This works fine for both json and pbf on chrome but not on firefox. Firefox ignores the header it seems.

I tried different caching header but none seem to work.

Here are the response+request headers for the second request (the one that uses caching) for json

Response:

HTTP/2 304 
vary: Origin,Accept-Encoding,Authorization
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
etag: "-1633907450"
content-encoding: gzip
date: Wed, 10 Apr 2024 14:07:01 GMT
X-Firefox-Spdy: h2

Request (browser)

GET *endpoint* HTTP/2
Host: *host*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
If-None-Match: "-1633907450"

and here are the ones for pbf:
Response:

HTTP/2 200 
vary: Origin,Accept-Encoding,Authorization
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
etag: "1761268274"
cache-control: max-age=14400, public
content-encoding: gzip
content-type: application/x-protobuf
content-length: 265
date: Wed, 10 Apr 2024 14:02:22 GMT
X-Firefox-Spdy: h2

Request (from the browser):

GET *endpoint* HTTP/2
Host: *host*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1

Solution

  • Firefox doesn't support caching for file downloads such as pbf.