I'm making a website based on my API is implemented on the server. API supports ETag, If-Modified-Since. The website is written using BackBone.js. When I use the methods of collection (fetch) to retrieve data from the server, backbone operates without cache-control. How can I set the appropriate headers (etag, etc.) in the query data?
Asked
Active
Viewed 1,053 times
3

ThiefMaster
- 310,957
- 84
- 592
- 636

Anthony Tsivarev
- 881
- 3
- 13
- 25
-
Cash? Are you my old stochastics professor by any chance? :p (protip: you pay with *cash* but you store things temporarily in a **cache**) – ThiefMaster Jun 06 '12 at 06:10
-
@TheifMaster, ups.. You're right) – Anthony Tsivarev Jun 06 '12 at 06:15
1 Answers
0
It really depends on your server as that's where the cache headers are set and the browser just obeys them. Most people use Apache or Nginx. For Nginx I like to cache static media for example:
location ~* ^.+\.(jpg|jpeg|gif|png|ico|eot|ttf|woff) {
root /var/www/html/mysite.com;
expires 90d;
}
Note that for any webserver you can get granular with your caching from the path down to the file extension of the request. Google and you will find how to set it for apache.

Mauvis Ledford
- 40,827
- 17
- 81
- 86