CDN

A Content Delivery Network (CDN) is a geographically distributed network of proxy servers that delivers content to end-users from the node closest to them, reducing latency and offloading traffic from the origin server.

CDNs cache static assets (images, CSS, JavaScript, fonts) and serve them with appropriate HTTP headers. They can also handle dynamic content acceleration, DDoS mitigation, TLS termination, and edge-side logic.

PHP contributes by setting correct HTTP caching headers so the CDN knows what to cache, for how long, and when to revalidate.

<?php

// Tell the CDN it may cache this response for 1 day; browsers for 1 hour
header('Cache-Control: public, max-age=3600, s-maxage=86400');
header('Vary: Accept-Encoding');

// Provide an ETag so the CDN can validate without a full download
$etag = md5_file(__DIR__ . '/asset.js');
header('ETag: "' . $etag . '"');

if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === '"' . $etag . '"') {
    http_response_code(304);
    exit;
}

?>

Documentation

See also Content delivery network.

Related : Cache, Latency, HTTP Headers, Load Balancer, Edge Computing, Horizontal Scaling, Time To Live (TTL)