From 8dd25f8a946e5bd661d8b3caa18e2874e66fed8c Mon Sep 17 00:00:00 2001 From: Adnan Haque Date: Tue, 10 Dec 2024 19:35:52 -0500 Subject: [PATCH 1/4] Add edge-cache header on atomic --- projects/plugins/boost/app/lib/minify/functions-service.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/plugins/boost/app/lib/minify/functions-service.php b/projects/plugins/boost/app/lib/minify/functions-service.php index 20812b65b62d2..7f3f0b0ffc06a 100644 --- a/projects/plugins/boost/app/lib/minify/functions-service.php +++ b/projects/plugins/boost/app/lib/minify/functions-service.php @@ -60,6 +60,9 @@ function jetpack_boost_page_optimize_service_request() { // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents $etag = '"' . md5( file_get_contents( $cache_file ) ) . '"'; + if ( defined( 'IS_ATOMIC' ) && IS_ATOMIC ) { + header( 'A8c-Edge-Cache: cache' ); + } header( 'X-Page-Optimize: cached' ); header( 'Cache-Control: max-age=' . 31536000 ); header( 'ETag: ' . $etag ); From d84498b5755c06d1bfe5d94c98abd9fc3044d297 Mon Sep 17 00:00:00 2001 From: Adnan Haque Date: Tue, 10 Dec 2024 19:37:03 -0500 Subject: [PATCH 2/4] changelog --- projects/plugins/boost/changelog/add-edge-cache-header | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/boost/changelog/add-edge-cache-header diff --git a/projects/plugins/boost/changelog/add-edge-cache-header b/projects/plugins/boost/changelog/add-edge-cache-header new file mode 100644 index 0000000000000..534f4a2e449ff --- /dev/null +++ b/projects/plugins/boost/changelog/add-edge-cache-header @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Minify: Added HTTP header to take advantage of WordPress.com edge caching From 40c3a336d9df33c3d1bf739cff8e2f04fa2462ed Mon Sep 17 00:00:00 2001 From: Adnan Haque Date: Fri, 13 Dec 2024 11:09:41 -0500 Subject: [PATCH 3/4] Update atomic check --- projects/plugins/boost/app/lib/minify/functions-service.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/plugins/boost/app/lib/minify/functions-service.php b/projects/plugins/boost/app/lib/minify/functions-service.php index 7f3f0b0ffc06a..0f53b7df8cf6b 100644 --- a/projects/plugins/boost/app/lib/minify/functions-service.php +++ b/projects/plugins/boost/app/lib/minify/functions-service.php @@ -60,7 +60,8 @@ function jetpack_boost_page_optimize_service_request() { // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents $etag = '"' . md5( file_get_contents( $cache_file ) ) . '"'; - if ( defined( 'IS_ATOMIC' ) && IS_ATOMIC ) { + // Check if we're on Atomic and take advantage of the Atomic Edge Cache. + if ( defined( 'ATOMIC_CLIENT_ID' ) ) { header( 'A8c-Edge-Cache: cache' ); } header( 'X-Page-Optimize: cached' ); From ff3f8e02bf3d925b74590d5968ea4bec251b4c5c Mon Sep 17 00:00:00 2001 From: Adnan Haque Date: Fri, 13 Dec 2024 12:11:31 -0500 Subject: [PATCH 4/4] Add edge-cache header when uncached as well --- projects/plugins/boost/app/lib/minify/functions-service.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/plugins/boost/app/lib/minify/functions-service.php b/projects/plugins/boost/app/lib/minify/functions-service.php index 0f53b7df8cf6b..08fbd8997447d 100644 --- a/projects/plugins/boost/app/lib/minify/functions-service.php +++ b/projects/plugins/boost/app/lib/minify/functions-service.php @@ -81,6 +81,10 @@ function jetpack_boost_page_optimize_service_request() { foreach ( $headers as $header ) { header( $header ); } + // Check if we're on Atomic and take advantage of the Atomic Edge Cache. + if ( defined( 'ATOMIC_CLIENT_ID' ) ) { + header( 'A8c-Edge-Cache: cache' ); + } header( 'X-Page-Optimize: uncached' ); header( 'Cache-Control: max-age=' . 31536000 ); header( 'ETag: "' . md5( $content ) . '"' );