Fetch() init.cache mode error


#1

Hello,

I’m using the fetch function on the Fetch API to POST to an API that fetches some user information from a database. Because it is a single use, I don’t want it to be cached. When following along in the MDN docs (I’d link to it, but I’m over my link quota) and add the cache mode for the request to no-store, I get:

Uncaught (in promise) Error: The 'cache' field on 'RequestInitializerDict' is not implemented.
    at fetchFromDb (worker.js:22131:26)
    at fetchUserByUsername (worker.js:22175:24)
    at doWork (worker.js:22587:15)
Uncaught (in response) Error: internal error

A few questions:

  1. When fetching POSTs do you cache the response?
  2. Do you plan on supporting the cache mode?
  3. Can you please add to the reference page that changing the cache mode is also not supported?

I’m am worried about this response that might be getting cached and web cache poisoning, since it is returning PII data. Also to note, I don’t have control over the response object back being returned from the database, since I am using their REST Endpoints.


#2

Said MDN doc: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch


#3

Why you didnt use http headers? If you send “Cache-Control: no-store, no-cache, must-revalidate, max-age=0” and Pragma: no-cache. Cloudflare doesnt cache your url.

Turn on the Origin cache control and send http header.


#4

I can’t change the database server’s response.