Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m ready to help

please configure the fotomoto server to enable caching for scripts

please configure the fotomoto server to enable caching for scripts.

currently the fotomoto server completely disabled caching for scripts. which means that if i load 10 pages that each include the fotomoto script, the fotomoto script will be re-fetched for each page, causing un-necessary delay and bandwith use (and un-necessary server load for fotomoto).

the fotomoto server could be configured for example to enable a 1-hour cache based on access time for the scripts.

since you use Apache, i could help you with that, it's very easy to do (and to test).

Currently, as you can see below, your server has caching OFF for the script files:

$ curl -D - -o /dev/null 'http://widget.fotomoto.com/stores/scr... removed...].js'
HTTP/1.1 200 OK
Date: Wed, 02 Mar 2011 02:51:33 GMT
Server: Apache
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.15
ETag: "b107ce2925d3a815db5f4fec730d8134"
X-Runtime: 22
Cache-Control: private, max-age=0, must-revalidate
Set-Cookie: _fotomoto_session=3f35e2b30e00548938f85fe9e68e5cb4; path=/; HttpOnly
Content-Length: 14513
Status: 200
Cache-Control: max-age=2592000
Expires: Fri, 01 Apr 2011 02:51:33 GMT
Vary: Accept-Encoding
Content-Type: text/javascript; charset=utf-8

The first Cache-Control header indicates cache OFF:

Cache-Control: private, max-age=0, must-revalidate

I think the problem is that you incorrectly emit two "Cache-Control" httpd headers. Only one header of each type is allowed in the httpd headers, and usually browsers will use the first one when there are severals (at least FireFox does that, i checked and tested the caching issue with Firebug on Firefox), so it is not a good idea to have multiple Cache-Control headers!

Also, you would probably want to use a lower max-age, like 3600 (1 hour), or maybe 1 day. but a value too large could prevent getting the latest script from your server if an old copy is in the browser's cache. i think the cache delay should be 1 day at the most.
2 people like
this idea
+1
Reply