Posted by john.boxall 3 years 19 weeks ago
Hey MobiForge!
I'm implementing a cache that varies depending on what device you are browsing the website with (eg. iPhone site gets content from the iPhone cache, S60 devices from the S60 cache etc.)
Is there an accepted HTTP Vary header for a device cache? (like Content-Language is accepted for different languages)
If so what is it? And what is it's commonly accepted value?
It seems wasteful to cache on the UA string (so many of them!)
For me, device a cache based on screen size seems to be the best choice as I'm using Device Atlas to reformat images based on screen size...
Has anyone else tackled this?
John




Posted by john.boxall 3 years ago
I just found this Andrea's previous post:
http://www.mobiforge.com/developing/story/setting-http-headers-advise-transcoding-proxies
Which covers a simple solution to this problem settings the cache to Vary on 'User-Agent'.
This is wasteful if you're only adapting content on screen sizes (like me) - but if you aren't worried about cache size (or only have a small # of UAs hitting your site) it's an easy solution to a difficult problem!
John
Posted by daniel.hunt 3 years ago
Mobile Grandmaster
Personally, I'd cache the content itself, but not the final formatted content.
Using the pre-cache stuff, I'd template it depending on the current client.
But yeah, if the cache size isn't a problem (or only a small # of UA's) then it would be fine
Daniel HuntdotMobi
Posted by john.boxall 3 years ago
For a Python / Django take on the solution take a look at:
http://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers
jb