Skip to content

Instantly share code, notes, and snippets.

@ashleymichal
ashleymichal / sites_caching.md
Last active October 4, 2019 21:47
how i would explain sites caching to the me of three months ago

Explaining Workers Sites Caching to a General Audience

0. Preface

This builds from most familiar to least familiar, most general to most specific. Section one will be review for most people. Section two will be review for some. etc.

1. what happens when you visit a website

When I point my browser at ashleymichal.github.io, the server returns an HTML file. As my browser parses it, it encounters references to other resources: stylesheets, scripts, images, etc. It makes new requests for each resource, and integrates the responses until the page is rendered.

[Show simple example of an html page with a stylesheet, script reference, and image; show the multiple requests to the server, perhaps in a devtools image.]

@ashleymichal
ashleymichal / maintenance-page-how-to.md
Last active March 19, 2021 01:21
writing a maintenance page

How to set up a maintenance page on Cloudflare Workers

overview

the TL;DR here is that we are uploading your site assets to cloudflare workers kv, to be served from cloudflare's edge network by a custom Worker, defined in the workers-site directory. the publish command below does all the work of uploading the assets and deploying the necessary worker. maintenance pages are a nice use case, since the worker intercepts all traffic through its configured route while it is up.

build your assets

This can be just a basic HTML page with images, or it can be from a static site generator. what's important is the built assets.