-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not set both Expires and Cache-Control: max-age #3560
Comments
So if |
Actually that even has a Cache-Control. The whole logic would be: // Set Cache-Control header (replaces Expires)
if ($cache_control) {
$headers['Cache-Control'] = strtolower($cache_control);
} elseif ($expires > 0) {
$headers['Cache-Control'] = 'max-age=' . $expires;
} With no Expires header at all, it would just use CacheControl for both scenarios of setting a |
Actually reading more, this is not 100% true, only if max-age is set is Expires ignored. Probably safer to just leave it as is. We could create logic to skip it if cache_control doesn't contain max-age, but what's the point? code gets ugly, an extra check, and browsers ignore anyway? |
I think it's confusing to output both when we know only one is useful at a time. |
You need both and it's hard to detect when only one is needed. I would keep the code as it is. |
In this part introduced in 3742be1
grav/system/src/Grav/Common/Page/Page.php
Lines 597 to 607 in 35d4d00
If
cache_control
is set, then theExpires
header will be output too which should rather not happen becauseThe presence of both may create confusion (for the developers at least)
The text was updated successfully, but these errors were encountered: