Cookie-less domain with site44

Written by
Date: 2012-12-02 21:28:35 00:00

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.

Some tries

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.

The solution

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:

HTTP/1.1 200 OK
Age: 1914
Cache-Control: public, max-age=2125
Content-Type: application/javascript
Date: Mon, 03 Dec 2012 01:20:51 GMT
ETag: "9695572dc92943ec9bb9484f43587812"
Last-Modified: Mon, 03 Dec 2012 00:45:26 GMT
Vary: Accept-Encoding
Via: 1.1 varnish
X-Varnish: 1023698238 1023696658
Connection: keep-alive

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.

Extra performance

If you want to improve performance even more, just enable Amazon CloudFront CDN, and point to your newly created domain at site44.