1

I setup a test website on localhost:8022 and for some reason the css style sheets are not cached. The max age of a cache is set to 0 in the header Cache-Control: max-age=0: enter image description here

If I visit the site with Chrome, cache is working. If I visit other websites in Firefox like https://superuser.com the cache is also working.

Why does Firefox send a max-age=0 in the request header for the locahost website. How can I change this behavior?

8
  • Have you tried to set an additional network name like 127.0.0.1 myserver.local to your address in the hosts file (and also use this address for requests)? Then Firefox may see the site as non-local and uses caching.
    – Robert
    Commented Jul 26, 2020 at 17:51
  • @Robert I just tried that out, but it still won't cache.
    – Adam
    Commented Jul 26, 2020 at 17:59
  • Do you always have the developer panel open? There is an option that disabled caching if the developer panel is open: stackoverflow.com/a/48027947/150978 (this option should be disabled by default).
    – Robert
    Commented Jul 26, 2020 at 18:19
  • @Robert the option is unchecked. For some reason, caching works on other sites on Firefox, but not for localhost.
    – Adam
    Commented Jul 26, 2020 at 18:22
  • You are using a query string "?ver=5.4.2" which usually the browser never caches.
    – harrymc
    Commented Jul 26, 2020 at 19:08

0

You must log in to answer this question.

Browse other questions tagged .