I have a Rails-generated JS file that I want to distribute via CloudFront (using my Rails app on EC2 as the origin server). Does anyone know which headers I should use in the response for my JS file to ensure that the end user's browser does not cache the JS file?
I know CloudFront does not respect any expires headers that are less than 1 hour… but the docs say those headers are still passed on to the client:
http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/
Am I safe using the following?
Cache-Control: no-cache
Pragma: no-cache
Best Answer
Hmm so it turns out I don't really want to be doing that at all. CloudFront respects
no-cache
headers so this will, in fact, not cache the JS file on CloudFront for an hour. It doesn't really make sense to use CloudFront for this... more information can be found on my AWS Forums post.