{
"$type": "site.standard.document",
"canonicalUrl": "https://johnnyreilly.com/posts/terry-pratchett-x-clacks-overhead-azure-static-webapps",
"description": "Terry Pratchett has a HTTP header: X-Clacks-Overhead. This post shows how we can make Azure Static Web Apps join in.",
"path": "/posts/terry-pratchett-x-clacks-overhead-azure-static-webapps",
"publishedAt": "2022-07-23T00:00:00.000Z",
"site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
"tags": [
"azure static web apps"
],
"textContent": "Terry Pratchett is remembered on the internet. A non-standardised HTTP header: X-Clacks-Overhead is broadcast by websites seeking to pay tribute to the great man. This post shows how we can make Azure Static Web Apps join in.\n\n\n\nWhat is X-Clacks-Overhead?\n\nThis is well documented in the X-Clacks-Overhead website. To quote the highlights:\n\n> X-Clacks-Overhead is a non-standardised HTTP header based upon the fictional work of the late, great, Sir Terry Pratchett...\n>\n> As a way to preserve the memory of Sir Terry Pratchett, the users of the SubReddit for the Discworld series came up with the idea behind the X-Clacks-Overhead HTTP Header. It allows web authors to silently commemorate someone through the use of a non-invasive header that can be transmitted from server to server, or server to client without operational interference.\n>\n> You would only know the header is present if you analysed the transmission headers of your content requests on web sites serving the header.\n\nPut simply, participating websites will broadcast the X-Clacks-Overhead: GNU Terry Pratchett header when they are serving content to a user.\n\nAzure Static Web Apps serving the X-Clacks-Overhead header\n\nNow we understand what we want to do, we can make an Azure Static Web Apps project do just that.\n\nWe're going to need an staticwebappconfig.json in root of our app, so we can configure our SWA. To add extra headers in, you use the globalHeaders setting:\n\nAbove, we added the X-Clacks-Overhead header. When our app is deployed, it will automatically add this header to all requests:\n\nThe above screenshot shows this very blog broadcasting the X-Clacks-Overhead header. If you crack open devtools you can validate this for yourself. The pull request that added it in can be found here.\n\nWho else is out there?\n\nIt's great to know you're in good company. This page tracks websites that are broadcasting the X-Clacks-Overhead header. You can see from the image below that it has found this website too!\n\nSo if you'd like your Azure Static Web App to whisper Terry Pratchett's name under its breath; make it so!",
"title": "Terry Pratchett and the Azure Static Web Apps"
}