Last modified: 2013-08-14 12:09:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T53283, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51283 - ResourceLoader should not respond with HTTP 304 without Expires (and other) headers
ResourceLoader should not respond with HTTP 304 without Expires (and other) h...
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-13 10:40 UTC by David Taylor
Modified: 2013-08-14 12:09 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description David Taylor 2013-07-13 10:40:24 UTC
There are two code paths that can lead to ResourceLoader.php calling tryRespondLastModified:

ResourceLoader::respond
  if ( $wgUseFileCache )
    ResourceLoader::tryRespondFromFileCache
      ResourceLoader::sendResponseHeaders
      ResourceLoader::tryRespondLastModified

or

ResourceLoader::respond
  tryRespondLastModified

Only one of these paths calls ResourceLoader::sendResponseHeaders.

The other path will set a HTTP 304 status and Status: 304 header, but no other headers.  The lack of the Expires header in particular causes a variety of odd problems when using (at least) mod_proxy/mod_disk_cache as an apache-based caching reverse proxy.

Using mod_proxy and mod_disk_cache from apache2 pre-2.2.18, this leads to the proxy returning erroneous 304 responses to clients who sent unconditional requests (see https://issues.apache.org/bugzilla/show_bug.cgi?id=45341).

After the fix/workaround added in 2.2.18, mod_proxy will now correctly send the cached content back to the client, but will then immediately purge the page from the cache, which is not ideal.

I fixed this locally by moving the call to sendResponseHeaders from the first call path after the call to tryRespondLastModified, then adding a call to sendResponseHeaders in tryRespondLastModified itself.
Comment 1 Gerrit Notification Bot 2013-07-18 17:55:23 UTC
Change 74400 had a related patch set uploaded by Catrope:
Always send headers with a 304 response in ResourceLoader

https://gerrit.wikimedia.org/r/74400
Comment 2 Bartosz Dziewoński 2013-07-23 18:30:58 UTC
Could this be the root cause of bug 51766 as well?

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


Navigation
Links