Search code examples
firefoxcachingpragmaxmlhttprequest

Stop Firefox from adding pragma and cache headers to XMLHTTP Req?


I've written an extension that sends XHR POSTs, but two headers are being added that I don't want:

Pragma: no-cache
Cache-Control: no-cache

I've read that someone else with this problem had turned off their cache in developer tools, but I don't recall doing this, and for all I can tell caching should be enabled.

What might be adding these?


Solution

  • Firefox is adding those headers. The relevant code comment is:

    // Bypass the network cache in cases where it makes no sense:
    // POST responses are always unique, and we provide no API that would
    // allow our consumers to specify a "cache key" to access old POST
    // responses, so they are not worth caching.
    

    That code was added in https://bugzilla.mozilla.org/show_bug.cgi?id=295074