I have a script that generates a new CSV file (in my web directory) every half hour, it replaces the original one and puts a new one in its place with the same file name, the file is linked to on my website.
When I download the file from my website, instead of getting an updated version I get a file that is the same as the first time I downloaded it on this computer.
My first thought was to make sure that the script is still running properly and after testing, I can confirm that it is.
I then cleared the cache and download history in Chrome and tried to download it again, this time it worked as intended.
I am running this off of a rackspace cloud server running ubuntu and apache. I assume there is some setting that I need to reconfigure to fix this problem. Could someone please point me in the right direction.
Thanks in advance.
When you're in Google Chrome, click on View, then select Developer, then Developer Tools. Alternatively, you can right click on a page in Chrome, then click Inspect. Click on the Network tab, then check the box to Disable cache.
On your custom origin web server application, add Cache-Control no-cache, no-store, or private directives to the objects that you don't want CloudFront to cache. Or, add Expires directives to the objects that you don't want CloudFront to cache.
A somewhat dirty solution is to append to the script that let you download the file a random number (or maybe the timestamp) as parameter to prevent the caching.
For example:
www.example.com/download.php?file=my.csv&rand=123456789
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With