Simple application served by Cloudflare Workers which interupts requests to your server while maintenance in progress.
- TailwindCSS
- Cloudflare Workers
- Easy to use npm script which enables and disables page
To deploy this page run
npm install
npm run workers:deploy
You can run npm run watch
and start writing your TailwindCSS classes in public/index.html
.
- Deploy your page (
npm run workers:deploy
) - Login your Cloudflare Dashboard
- Navigate to
maintenance-screen
worker ->routes
section - Enable wildcard routing for your zone (eg:
domain.dev/*
or*.domain.dev/*
)
Done, all your traffic will be routed to maintenance page.
- Add route to
wrangler.toml
(required for wrangler to rewrite routes after disable command)route = "domain.dev/maintanence"
- define any unused url of your application - Edit
wrangler.enable.toml
. Adjustroutes
parameter, by default it handles all requests to root domain and all URI's
npm run workers:enable
- deploys app && enables configured routes in wrangler.enable.toml
npm run workers:disable
- deploys app && enables configured route in wrangler.toml