Closed Bug 762252 Opened 12 years ago Closed 12 years ago

developer-new.mozilla.org, developer-stage9 prohibit HTTP caching

Categories

(developer.mozilla.org Graveyard :: Editing, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: asqueella, Assigned: lorchard)

References

Details

(Whiteboard: s=2012-07-25 p=1)

It appears that any response from developer-new.mozilla.org comes with these headers, whether you're logged in or not:
> Pragma: no-cache
> Cache-Control: no-cache, must-revalidate
> Expires: Thu, 19 Nov 1981 08:52:00 GMT

This disables bfcache <https://developer.mozilla.org/En/Using_Firefox_1.5_caching> and makes the pages slower to load.

The production site developer.mozilla.org has its own problems (bug 711371, bug 606190), but at least it doesn't send these headers and not for all requests.


Full headers below.

Request headers:

GET /en-US/docs/DOM/DOM_event_reference HTTP/1.1
Host: developer-new.mozilla.org
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.21 Safari/536.11
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: csrftoken=5f7f7a3024aae8cb13788e8adbf16b87; WT_FPC=id=91.79.103.251-3633354272.30229543:lv=1338973424773:ss=1338973424773

Response Headers

HTTP/1.1 200 OK
Date: Wed, 06 Jun 2012 21:03:51 GMT
Server: Apache
X-Kumascript-Caching: 200 OK, Age: 0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Vary: Cookie
x-kuma-revision: 6301
Pragma: no-cache
Cache-Control: no-cache, must-revalidate
x-frame-options: DENY
Set-Cookie: csrftoken=5f7f7a3024aae8cb13788e8adbf16b87; Max-Age=31449600; Path=/
X-Backend-Server: developer3.webapp.scl3.mozilla.com
Last-Modified: Tue, 29 May 2012 12:20:28 GMT
Content-Length: 51821
Keep-Alive: timeout=5, max=1000
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
Did a little digging. This comes from sumo.middleware.NoCacheHttpsMiddleware and is very easily disabled by removing the middleware from settings.py.

Kitsune disabled caching under https:// to address bug 584931. It seems like the main thing there was that personalized info (eg. logged in username) was being cached. But, we send a `Vary: Cookie` header, which should prevent that by requiring a logged in user's cookie to be considered in caching. So, it seems safe to turn this off for us.

https://github.com/mozilla/kuma/pull/344
Assignee: nobody → lorchard
Blocks: 771763
No longer blocks: 756263
Priority: -- → P1
This may help internally, too- Kumascript queries go through Zeus, and Zeus will cache things according to cache headers. So, if we do implement this and it affects the pages Kumascript calls, we'll be alleviating potentially a lot of back-and forth Kuma/Kumascript traffic and turning it into a simple cache hit.

Django->Kumascript I believe does not go through Zeus (or any caching layer), so I don't think there's anything to gain by having cache headers there. Still, short-circuiting some Kumascript->Django traffic seems like a major win.

The Zeus cache has a TTL cap on it... usually 10 minutes. Just mentioning for completeness.
This has a pull request, just pending a review and merge by someone not-me:

https://github.com/mozilla/kuma/pull/344
Whiteboard: s=2012-07-17
Whiteboard: s=2012-07-17 → s=2012-07-17 p=1
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/9e40c18c0abe3f0a39a77458d77c0c1eb8b93e42
bug 762252: Disable NoCacheHttpsMiddleware to allow caching under HTTPS

https://github.com/mozilla/kuma/commit/18dad6c08fcb297035c065241790855e3a08785a
Merge pull request #344 from lmorchard/disable-nocache-middleware-762252

bug 762252: Disable NoCacheHttpsMiddleware to allow caching under HTTPS
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: s=2012-07-17 p=1 → s=2012-07-25 p=1
Version: Kuma → unspecified
Component: Docs Platform → Editing
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.