Skip to content

Commit dafbc7e

Browse files
committed
Remove no-cache and max-age=0 from bfcache failure conditions
1 parent 2b1bf18 commit dafbc7e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

plugins/performance-lab/includes/site-health/bfcache-compatibility-headers/helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function perflab_bfcache_compatibility_headers_check(): array {
6868
foreach ( (array) $cache_control_headers as $cache_control_header ) {
6969
$cache_control_header = strtolower( $cache_control_header );
7070
$found_directives = array();
71-
foreach ( array( 'no-store', 'no-cache', 'max-age=0' ) as $directive ) {
71+
foreach ( array( 'no-store' ) as $directive ) {
7272
if ( str_contains( $cache_control_header, $directive ) ) {
7373
$found_directives[] = $directive;
7474
}

plugins/performance-lab/tests/includes/site-health/bfcache-compatibility-headers/test-bfcache-compatibility-headers.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ public function data_test_bfcache_compatibility(): array {
9191
),
9292
'no_cache' => array(
9393
$this->build_response( 200, array( 'cache-control' => 'no-cache' ) ),
94-
'recommended',
95-
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: <code>no-cache</code>',
94+
'good',
95+
'If the <code>Cache-Control</code> page response header includes directives like',
9696
),
9797
'max_age_0' => array(
98-
$this->build_response( 200, array( 'cache-control' => 'max-age=0' ) ),
99-
'recommended',
100-
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: <code>max-age=0</code>',
98+
$this->build_response( 200, array( 'cache-control' => 'no-cache' ) ),
99+
'good',
100+
'If the <code>Cache-Control</code> page response header includes directives like',
101101
),
102102
'max_age_0_no_store' => array(
103103
$this->build_response( 200, array( 'cache-control' => 'max-age=0, no-store' ) ),
104104
'recommended',
105-
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directives: <code>no-store</code>, <code>max-age=0</code>',
105+
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: <code>no-store</code>',
106106
),
107107
'error' => array(
108108
new WP_Error( 'http_request_failed', 'HTTP request failed' ),

0 commit comments

Comments
 (0)