Skip to content
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

Boost: Add edge-cache header on WP Cloud #40557

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading