Closed Bug 662116 Opened 14 years ago Closed 13 years ago

Optimizaton: Set proper Cache-Control for JS and CSS files

Categories

(Pancake Graveyard :: Back-end, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: st3fan, Assigned: gbrander)

Details

Cache static assets like js and css on the client. Ideally we reference these in the code with a version number or time stamp attached. Like /js/main.js?v=28372372992. That way it is easy to force an expiration on the client. This timestamp can be updates automatically every deployment if we turn index.html back into a template.
Assignee: nobody → sarentz
I set the js/css/png files to expire after a day. The only request I see now when loading the site is on /api/top so that is pretty good.
Cool. That should be enough to get decent performance. The front end also caches the /api/search results for 5 minutes to reduce network traffic.
So this seems to work as expected on Safari and Firefox on the desktop but completely fails in Mobile Safari on the iPad. Have to figure out why it behaves different.
They probably don't have any disk cache, like Fennec.
Found this .. http://www.yuiblog.com/blog/2010/06/28/mobile-browser-cache-limits/ Sucks. Maybe we can improve things in the native wrapper.
I think this is done. Needs some real world testing. If it needs to be tuned then we can reopen this bug.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
We're having asset caching issues with the current build of the app.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I'm going to take the simple approach of adding a cache-busting string to the config file. This can be automated at a later date. See http://html5boilerplate.com/docs/Version-Control-with-Cachebusting/ for details on this technique.
Assignee: sarentz → gbrander
Target Milestone: --- → M2
Added cachebusting variable to config, passing to templates. Added ?v={{v}} to the end of static resources. Commits: https://bitbucket.org/mozillapancake/pancake/changesets/tip/branch%28%22cachebusting%22%29
Status: REOPENED → RESOLVED
Closed: 14 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.