I have a cron job that runs every 10 minutes and updates the content-type and x-amz-meta. But since yesterday it seems like after the cron job run, Amazon is not picking up the changes made (refreshing his cache).
I even went and made the changes manually but no change...
When a video is uploaded it has a application/x-mp4
content-type and the cron job changes it to video/mp4
.
Although S3 has the right content type video/mp4
cloudfront shows application/x-mp4
(old content-type) ....
The cron job has been working for the last 6 months without a problem.
What is wrong with amazon caching? How can i synchronize the caching?
Use Invalidations to clear the cache, you can put the path to the files you want to clear, or simply use wild cards to clear everything.
This can also be done using the API! http://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateInvalidation.html
The AWS PHP SDK now has the methods but if you want to use something lighter check out this library: http://www.subchild.com/2010/09/17/amazon-cloudfront-php-invalidator/
user3305600's solution doesn't work as setting it to zero is the equivalent of Using the Origin Cache Headers.