Jeff-Lewis / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ConditionGet always adds "must-revalidate" directive to Cache-Control header #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.x
PHP version: 5.x

What steps will reproduce the problem?
1. Using Minify with conditional GETs, setting a maxAge
2. Using the URI builder with groups to generate a single URI with a timestamp

Expected output:
Because we're using a timestamp, there is no need for an extra HTTP request
(albeit one that returns a 304) for minified resources, as the timestamp
will change when any of the resources change.

Actual output:
However with maxAge set, the Cache-Control header is sent in the
constructor of the ConditionalGet class, which is fine, but it is *always*
sent with the must-revalidate directive which forces the browser to always
send a request to check the etag and update headers to see if the file has
changed, returning a 304 if it hasn't.

Did any unit tests FAIL?
No.

Please provide any additional information below.

I think the best solution for this is an extra settings passed into the
constructor, like maxAge, that allows must-revalidate to be disabled, find
an example patch attached.

In high-load sites we've found getting rid of even this small extra request
per resource can make a difference.

Original issue reported on code.google.com by 1stv...@gmail.com on 13 Jan 2009 at 4:49

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry didn't attach the patch.

Original comment by 1stv...@gmail.com on 13 Jan 2009 at 4:50

Attachments:

GoogleCodeExporter commented 9 years ago
When max-age is set (even with "must-revalidate"), the browser honors it: when 
you 
browse links, further requests for the file are not sent (unless you manually 
refresh the page). I've just verified this behavior using Fiddler on Opera, 
Firefox 
3 and IE8b2.

Are you directly reloading the page (F5) and seeing 304s? Because there's 
nothing we 
can do about that AFAIK. Do you have a public URL?

Original comment by mrclay....@gmail.com on 13 Jan 2009 at 11:30

GoogleCodeExporter commented 9 years ago
My apologies for a useless report. Having taken a look at the problem myself, it
seems the tech dept had Apache misconfigured so that a pragma directive was also
coming through on the live servers (but not on dev), having sorted this out you 
are
indeed right about browsers respecting max-age.

Original comment by 1stv...@gmail.com on 14 Jan 2009 at 10:15

GoogleCodeExporter commented 9 years ago
No problem.

Original comment by mrclay....@gmail.com on 14 Jan 2009 at 12:14