Most of the code has been copy-pasted from https://github.com/jshttp/basic-auth
I use it to protect static html pages.
- Set credentials in index.js
const NAME = "super"
const PASS = "secret"
- Build
yarn build
(or npm run build
)
- copy
dist/main.js
to your cloudflare worker and deploy