gittip/www.gittip.com — pull request #1969 by zwn (2014-02-01 13:19:34+00:00)
Title: Cleanup assets serving

First commit in this PR fixes https://app.getsentry.com/gittip/gittip/group/13299458/ where we have so far 7.4k of exceptions. The trouble there has been that we were trying to set last modified time even on responses other than 200 (404 for example).

Second commit unifies our http caching strategy (#1555). Before we had two kinds of assets - long term and short term (versioned). For the long term, where we would want the maximum caching, we were not setting expire time. That means that the browser cannot know if the cached version is current or not without a hit to the server. We try to respond with 304 (not modified) but it is still a hit. Moreover we respond 304 not often enough because the decision to do so is based on mtime of the file. With each deploy possibly a new git checkout is made which results in mtime of 'now'. To conclude, the files we would want to be cached the most, were not.

Now all assets have far future expire time that allows the most caching. Our versioned assets (served from assets/%version/*) are invalidated with each deploy automatically. The other assets need to have their own version embedded in url (which is the case with jquery already).

Third commit makes a run to move all assets to CDN. What is not done yet a references from css files where I was not sure how to do the url expansion for `website.asset_url`.

Fourth folds separate css files into our main gittip.scss file to reduce the number of http requests to make the site speedier.

I'd appreciate a full review and thorough TTW test before merge & release. Thanks.

cc: @seanlinsley @clone1018 @duckinator