I have a site that uses several Ajax calls to acquire (JSON) data that is used by client-side Javascript to render the page. I am working to have my server-side scripts return better headers to optimize performance. In my test results, under Speed Optimization, I get a report to “Remove query string from static resources.” The resources referenced are for CGI scripts that return data.
Further, WPT advices that these “static resources” should be served from a cookieless domain. While I do use a distinct domain for true static resources (CNAMEd to my CDN), these scripts need information from the client in order to properly assemble the returned JSON payload. The data is transmitted to the scripts by both cookies and query string arguments.
So, I am curious how WPT determines what is a “static resource” ?
Here are the Headers returned for one of these Ajax calls:
Cache-Control:public, max-age=86400
Connection:Keep-Alive
Content-Encoding:gzip
Content-Type:application/json; charset=utf-8
Date:Thu, 27 Jan 2011 12:46:05 GMT
Keep-Alive:timeout=2, max=194
Last-Modification:Wed, 25 Aug 2010 14:15:20 GMT
Server:Apache
Transfer-Encoding:Identity
Vary:Accept-Encoding
Notes:
-
my script examines the request header for Accept-Encoding, and returns gzip’d content when possible (which is the case in the Headers above)
-
the script is returning content derived from a file. I never know when that data will change, and presently it has not changed in a while (the Last-Modification header is the date of the last change to the file). But since it may change, I set the cache max-age to 1 day.