etag header not reliable in HEAD requests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Software Center Agent |
Fix Released
|
Undecided
|
Anthony Lenton |
Bug Description
When testing my lp:~mvo/software-center/no-restfulclient-for-what-is-available/ branch I noticed that the etags header is not always returned:
$ curl -I https:/
HTTP/1.1 200 OK
Date: Wed, 22 Sep 2010 15:46:34 GMT
Server: Apache/2.2.14 (Ubuntu)
ETag: "4278440f25214c
Expires: Wed, 22 Sep 2010 15:48:07 GMT
Cache-Control: max-age=600
Last-Modified: Wed, 22 Sep 2010 15:38:07 GMT
Content-Type: application/json
Via: 1.1 software-
$ curl -I https:/
HTTP/1.1 200 OK
Date: Wed, 22 Sep 2010 15:46:39 GMT
Server: Apache/2.2.14 (Ubuntu)
Content-Type: application/json
Via: 1.1 software-
It seems to be a bit random, maybe 1 out of 3 or 1 out of 4 times.
Changed in software-center-agent: | |
milestone: | none → 10.10 |
summary: |
- etag header not reliable + etag header not reliable in HEAD requests |
Changed in software-center-agent: | |
status: | Fix Committed → Fix Released |
Hi, this was due to the interaction of two django middlewares, CommonMiddleware and UpdateCacheMidd leware. As CommonMiddleware removes the content for HEAD requests before UpdateCacheMidd leware gets a chance to calculate the ETag header, you will only get an ETag header when you've recently made a GET request for the same URL, in which case the ETag header is already cached.
This was compounded by the fact that, having two app servers, the header was some times cached in one app server but not in the other.
I've changed the USE_ETAGS setting to True to have the CommonMiddleware always calculate the ETags header for every request, which solves the issue locally. We should test again once this config change has been deployed.