Skip to content

Commit f02570d

Browse files
shorten browser cache length to 1 hour, shared is already close enough
1 parent 76a250f commit f02570d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

includes/set-cache-headers.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
if (is_user_logged_in()) {
1919
$headers['Cache-Control'] = 'must-revalidate, max-age=0, private';
2020

21-
// cache 404 pages for 1 hour (shared), 5 minutes (browser)
21+
// cache 404 pages for 1 hour (shared) or 5 minutes (browser)
2222
} elseif (is_404()) {
2323
$headers['Cache-Control'] = 'public, s-max-age=3600, max-age=300';
2424

25-
// cache feeds and XML files (ie sitemap) for 1 day (both shared and browser)
25+
// cache feeds and XML files (ie sitemap) for 1 day (shared) or 1 hour (browser)
2626
} elseif (is_feed() || str_ends_with($_SERVER['REQUEST_URI'] ?? '', '.xml')) {
27-
$headers['Cache-Control'] = 'public, max-age=86400';
28-
// cache all other pages for 30 days (shared) or 1 day (browser cache)
27+
$headers['Cache-Control'] = 'public, s-max-age=86400, max-age=3600';
28+
29+
// cache all other pages for 30 days (shared) or 1 hour (browser)
2930
} else {
30-
$headers['Cache-Control'] = 'public, s-max-age=2592000, max-age=86400';
31+
$headers['Cache-Control'] = 'public, s-max-age=2592000, max-age=3600';
3132
}
3233

3334
return $headers;

0 commit comments

Comments
 (0)