Bug 794755 - Static assets don't set Cache-Control headers
Summary: Static assets don't set Cache-Control headers
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: aeolus-configure
Version: 1.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
Assignee: John Eckersberg
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-17 14:42 UTC by Matt Wagner
Modified: 2014-08-17 22:27 UTC (History)
4 users (show)

Fixed In Version: v2.5.0-15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-30 17:12:59 UTC


Attachments (Terms of Use)
Unnecessary Requests (221.88 KB, image/png)
2012-02-17 14:42 UTC, Matt Wagner
no flags Details

Description Matt Wagner 2012-02-17 14:42:31 UTC
Created attachment 563922 [details]
Unnecessary Requests

Description of problem:

When serving static assets (e.g., stylesheets, JavaScript, images), we don't set any headers indicating that they can be cached. Apache sets an Etag, but that still requires that we do a conditional GET on every request. (The conditional GET saves the bandwidth of serving the image again, but still incurs the latency of the HTTP request.) We end up with at least a dozen unnecessary HTTP requests on every page.

AssetTagHelper appends timestamps as a query parameter, so we can set a Cache-Control directive allowing these assets to be cached forever -- if we change a stylesheet, it will end up with a new timestamp in the URL and get reloaded automatically.

I'm attaching a screenshot showing Firebug with a warm cache. Note that there are many more queries not depicted because I expanded the CSS to show the Etag header and the If-None-Match / If-Modified-Since conditional GET.

This needs to be fixed in our Apache config.

Comment 1 John Eckersberg 2012-02-21 21:25:04 UTC
Patch sent to list - https://fedorahosted.org/pipermail/aeolus-devel/2012-February/009072.html

Comment 2 Matt Wagner 2012-02-22 16:05:23 UTC
ACKed (with trivial change) and pushed onto master: b69c475e8e0cbf765655d4fdce4ca1d2c5957cf4

Comment 3 wes hayutin 2012-02-24 02:55:49 UTC
Date	Fri, 24 Feb 2012 02:51:35 GMT
Etag	"31a6061-64e-4b994793a39c0"
Expires	Sat, 23 Feb 2013 02:51:35 GMT

looks like it expires in one year.. verified


HeadersResponseCache
Response Headers
Accept-Ranges	bytes
Cache-Control	max-age=31536000
Content-Length	1614
Content-Type	text/css
Date	Fri, 24 Feb 2012 02:51:35 GMT
Etag	"31a6061-64e-4b994793a39c0"
Expires	Sat, 23 Feb 2013 02:51:35 GMT
Last-Modified	Wed, 22 Feb 2012 21:47:27 GMT
Server	Apache/2.2.15 (Red Hat)
Request Headers
Accept	text/css,*/*;q=0.1
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding	gzip, deflate
Accept-Language	en-us,en;q=0.5
Connection	keep-alive
Cookie	_session_id=daed0e167803d8d80daadec694a91f10
Host	qeblade31.rhq.lab.eng.bos.redhat.com
Referer	https://qeblade31.rhq.lab.eng.bos.redhat.com/conductor/images/new?environment=1
User-Agent	Mozilla/5.0 (X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Response Headers From Cache
Accept-Ranges	bytes
Cache-Control	max-age=31536000
Content-Length	1614
Content-Type	text/css
Date	Fri, 24 Feb 2012 02:51:35 GMT
Etag	"31a6061-64e-4b994793a39c0"
Expires	Sat, 23 Feb 2013 02:51:35 GMT
Last-Modified	Wed, 22 Feb 2012 21:47:27 GMT
Server	Apache/2.2.15 (Red Hat)




[root@qeblade31 conf]# rpm -qa | grep aeolus
aeolus-conductor-daemons-0.8.0-35.el6.noarch
rubygem-aeolus-image-0.3.0-9.el6.noarch
rubygem-aeolus-cli-0.3.0-10.el6.noarch
aeolus-all-0.8.0-35.el6.noarch
aeolus-conductor-0.8.0-35.el6.noarch
aeolus-conductor-doc-0.8.0-35.el6.noarch
aeolus-configure-2.5.0-15.el6.noarc


Note You need to log in before you can comment on or make changes to this bug.