X-Clacks-Overhead

We now support the X-Clacks-Overhead, or, the internet as a tool to not forget

A man is not dead while his name is still spoken. - Going Postal, Chapter 4 prologue

In Terry Pratchett’s Discworld series, “The Clacks” is a network of Semaphore Towers that operate in a similar fashion to telegraph.

“Clacks” because of the clicking sound the system makes as signals send.

In Going Postal, the book mentions that the inventor of the Clacks lost his son and in order to keep his memory alive, he transmitted his son’s name as a special operational signal through the Clacks. The signal was;

GNU John Dearheart

This is a three letter instruction, followed by the person’s name

  • G: Send the message onto the next Clacks Tower.
  • N: Do not log the message.
  • U: At the end of the line, return the message.

The nature of the GNU code means it will keep the name of his son forever transmitting through The Clacks network so long as the network existed.

Terry Pratchett, was by all accounts, a lovely person, and it would be nice if his name was able to get transmitted around a network forever.

Enter http://www.gnuterrypratchett.com, a call to action to set a header on internet requests to specifically transmit his name along with the GNU code. On this page you can find how to add the header to a range of servers and services.

GNU on Tosbourn

We’ve added the header to tosbourn.com! You can test it by running;

curl -I https://tosbourn.com | grep x-clacks-overhead

This brings back the response headers for a given page, and then uses grep to search for the specific header, it should return;

x-clacks-overhead: GNU Terry Pratchett

Or you can check out this screenshot, which is a sample of the full result of curl -I https://tosbourn.com.

Terminal output, with some random headers, but importantly; x-clacks-overhead: GNU Terry Pratchett
A screenshot showing the x-clacks-overhead header

This site is hosted on Github Pages, and we don’t get access to server configs to do this in say nginx or apache. What we do instead is use a CloudFlare worker, which we were already using to set some security headers.

The (cut down) worker code looks like this;

let securityHeaders = {
  "X-Xss-Protection" : "1; mode=block",
  "X-Frame-Options" : "DENY",
  "X-Content-Type-Options" : "nosniff",
  ...
}

let discworldHeaders = {
  "X-Clacks-Overhead" : "GNU Terry Pratchett",
}

addEventListener('fetch', event => {
  event.respondWith(addHeaders(event.request))
})

async function addHeaders(req) { 
  let response = await fetch(req)
  let newHdrs = new Headers(response.headers)
  let setHeaders = Object.assign({}, securityHeaders, discworldHeaders)

  Object.keys(setHeaders).forEach(name => {
    newHdrs.set(name, setHeaders[name]);
  })

  return new Response(response.body , {
    status: response.status,
    statusText: response.statusText,
    headers: newHdrs
  })
}

If you like Terry Pratchett’s work, or have anyone you’d like to remember, consider setting a similar header!

Recent posts View all

PersonalWeb Dev

X-Clacks-Overhead

We now support the X-Clacks-Overhead, or, the internet as a tool to not forget

JavaScript

Setting a more specific database type in Prisma

Prisma sets a default of TEXT for all String fields, here is how you can override that.