AWS 2026 Toronto Summit DEV203 Amazon CloudFront ​Deep Dive: Tap into ​Hidden Features

Welcome 2026 AWS Summit Toronto attendee!

Please leave a review for my session within the AWS Events application as soon as you get a moment.

Links

Posts on relevant topics:

CloudFront Function – WordPress Cache Buster

The following CloudFront function is an example how you can use a special HTTP header to “bust” through the CloudFront cache. The HTTP header you use should be part of the Cache policy’s headers to work.

/*
 * CloudFront request function - WordPress Cache Buster for signed in users
 */
const busterHeader = 'x-cache-buster'; // This header is added to the CloudFront cache key Policy

async function handler(event) {
    var request = event.request;

    // Accessing a cookie value
    if (request.cookies) {
        var cookies = request.cookies;
        Object.keys(cookies).forEach(key => {
            if( key.startsWith('wordpress_logged_in_') ) { // Generate a random UUID v4 string
                const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
                    const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
                    return v.toString(16);
                });
                request.headers[busterHeader] = {value: uuid };
                return request;
            }
        });
    }

    return request;
}

// eof

Looking for more?

Browse my archive of Amazon Web Services posts for even more helpful content.

Join My FREE Newsletter

Get the latest news and episodes of the Cloud Entrepreneur Podcast and Angelo’s development blog directly in your inbox!