Mobile app version of vmapp.org
Login or Join
Angela700

: Can Amazon Cloudfront files be served GZIP'd? If i'm running a WordPress website with the W3TC plugin installed, and have my static CSS/JS minified files hosted on Amazon's CDN, is there a way

@Angela700

Posted in: #AmazonCloudfront #Cdn #Compression #Gzip #Wordpress

If i'm running a WordPress website with the W3TC plugin installed, and have my static CSS/JS minified files hosted on Amazon's CDN, is there a way to serve them GZIP'd?

I have the basic understanding that you can't control the comrpession/header responses on files not hosted on your own server, but I'm using a CNAME and .htaccess should be ensuring the files are served compressed.

Has anyone got experience with this or know how to ensure the files are served compressed?

[Question has been asked on the WordPress support forum with the W3TC tag]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@XinRu657

Yes, Amazon Cloudfront can now serve GZip'ed / HTML Compressed content to end users fairly easily. This used to be rather hard, but Amazon added this to Cloudfront around November 2010.

What you are looking for is called "custom origin". The gist of it is:


You set up your own web server, and configure this server to correctly compress content for supporting clients, and correctly emit the proper HTTP cache control and compression headers. Once you're done with this, you may want to check it with the excellent RedBot inspector.
You set up your Cloudfront distribution with your own server as the custom origin server.
In your HTML, you change the paths for your static content to the Cloudfront hosted URLs.
Cloudfront caches your content on their edge nodes. Cloudfront preserves the client HTTP headers when connecting to your origin server, and Cloudfront only serves up compressed content to other clients which present matching HTTP headers. Thus your origin server is in control of which clients receive compressed content, based on the HTTP headers.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme