1

I want to force the browser to not cache files for my react based web app for more than a day. How do I do that?

Aviral Bajpai
  • 53
  • 1
  • 8
  • 1
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control – ayrusme Mar 15 '18 at 09:45
  • Is there a way to set the cache-control header in s3 or cloudfront? – Aviral Bajpai Mar 15 '18 at 09:54
  • Try reading: https://stackoverflow.com/questions/18774069/amazon-cloudfront-cache-control-no-cache-header-has-no-effect-after-24-hours – ayrusme Mar 15 '18 at 10:01
  • I think your first comment will work. (Found a way to add cache-control header from s3). For reference you can go to object -> Properties -> Metadata -> Add Metadata -> Select Cache-Control and put value as (public, max-age=86400) – Aviral Bajpai Mar 15 '18 at 10:13
  • As mentioned in your second link, this is not for cloudfront to not cache it for more than a day. This is for the browser referencing older files. I already dealt with cloudfront caching issue with invalidation feature in cloudfront. – Aviral Bajpai Mar 15 '18 at 10:14

1 Answers1

0

Type in the address bar

about:config

then press the button

I accept the risk

then type in the bar

browser.cache.disk.enable

then double click on it, to make it false

exit firefox and restart-it.

do the same with

browser.cache.memory.enable

and set to 1 the pref

browser.cache.check_doc_frequency

if you want to read more:

http://kb.mozillazine.org/Browser.cache.disk.enable

http://kb.mozillazine.org/Browser.cache.memory.enable