Skip to content

Commit

Permalink
Boost: Add edge-cache header on WP Cloud (#40557)
Browse files Browse the repository at this point in the history
* Add edge-cache header on atomic

* changelog

* Update atomic check

* Add edge-cache header when uncached as well
  • Loading branch information
haqadn authored Dec 20, 2024
1 parent 8109ade commit acacbbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions projects/plugins/boost/app/lib/minify/functions-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ 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 ) ) . '"';

// 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' );
header( 'Cache-Control: max-age=' . 31536000 );
header( 'ETag: ' . $etag );
Expand All @@ -77,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 ) . '"' );
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/boost/changelog/add-edge-cache-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Minify: Added HTTP header to take advantage of WordPress.com edge caching

0 comments on commit acacbbe

Please sign in to comment.