Amazon S3 Cloudfront Deployment Best Practice

后端 未结 2 1751
忘掉有多难
忘掉有多难 2021-01-30 11:07

Our current plan for a site is to use Amazon\'s Cloudfront service as a CDN for asset files such as CSS, JavaScript, and Images, and any other static files.

We currently

2条回答
  •  终归单人心
    2021-01-30 12:04

    You can issue invalidation requests to CloudFront.

    http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

    Instead of an S3 bucket, though, we use our own server as a custom origin. We have .htaccess alias style_*.css to style.css, and we inject the file modification time for style.css in the HTML. As CloudFront sees a totally different URL, it'll fetch the new version.

    (Note: Some CDNs let you do that via query string, but CloudFront ignores all query string data for caching, hence the .htaccess solution.)

    edit: CloudFront can be (optionally) configured to use query strings now.

提交回复
热议问题