Bug 83925 - REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached
Summary: REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Alexey Proskuryakov
Keywords: InRadar, Regression
Depends on:
Reported: 2012-04-13 11:46 PDT by Alexey Proskuryakov
Modified: 2012-04-13 13:58 PDT (History)
2 users (show)

See Also:

proposed fix (4.16 KB, patch)
2012-04-13 13:54 PDT, Alexey Proskuryakov
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2012-04-13 11:46:14 PDT
When using Rails with Apache, it's common to have two max-age directives (one is added by Rails, another by mod_expires):

max-age=0, private, must-revalidate, max-age=60

We appear to honor the last directive instead of the first,like other browsers do.

Steps to reproduce:
1. Terminal: sudo gem install sinatra
2. Download and unzip the attached archive.
3. In Terminal, cd to the archive's directory and run 'ruby app.rb'
4. In Safari, open a new window and navigate to http://localhost:4567
5. Click the button on the page and observe the output from the ruby command above.

I confirmed that this test started to fail in r107672, although the root cause is really a pre-existing issue with memory cache (the same is reproducible with script elements).

Nate, is this something you'd be willing to look into?

Comment 1 Nate Chapin 2012-04-13 11:51:58 PDT
I'd be happy to. Fair warning though, I don't know all that much about the part of the cache that actually handles caching headers, so I may be slow to figure it out.
Comment 2 Alexey Proskuryakov 2012-04-13 13:36:51 PDT
Actually, this might be as easy as adjusting precedence in ResourceResponseBase::parseCacheControlDirectives(). I'll take a look.
Comment 3 Alexey Proskuryakov 2012-04-13 13:54:32 PDT
Created attachment 137141 [details]
proposed fix
Comment 4 Antti Koivisto 2012-04-13 13:55:56 PDT
Comment on attachment 137141 [details]
proposed fix

Comment 5 Alexey Proskuryakov 2012-04-13 13:58:09 PDT
Committed <http://trac.webkit.org/changeset/114165>.