From time to time, I try to improve the performance of the site. I still do not know why, but it just happens, something start to itch me, and I need to improve things that are already working.
Today, I wanted to find a way to have the cookieless domain for my assets.
I first tried to serve my css and js files from Amazon S3, but it has some limitations.
It is hard for Amazon to serve gzip files, or better said, just to serve gzip files to those browsers that support it, and not to those which does not.
Headers, can me managed, but there is no way, and no reason either to use vary: accept encoding header. There is no reason to use, it because Amazon S3, does not follow the request of the browser, it just serve the file compressed or uncompressed whatever it has available.
My solution was, to create a new site with site44, and name it something like assets.yourdomain.com, and copy there my css and js files.
Here are the headers of my assets right now:
max-age is not optimal for css files, but that number is going to increase with the time, as site44 sees that there is no change in the file. I will increase up to: 86400 which is 24 hours, is not the best for css files, but is not bad.
Now all I have to do, is change my template, so all css and js files are served from that new domain, I can do the same with images.
If you want to improve performance even more, just enable Amazon CloudFront CDN, and point to your newly created domain at site44.