The cookie-worker is a Rust library
that adds a cookie consent banner to any Cloudflare Worker site — without touching
your site’s code. Use
this template
to create your own repository containing just your configuration, and let GitHub
Actions handle the deploy.
It acts as a transparent reverse proxy in front of your existing Cloudflare Worker or Pages site. HTML responses pass through the worker, which injects the banner HTML, CSS, and JavaScript before returning them to the browser. Non-HTML responses (images, scripts, JSON, etc.) are passed through unmodified.
cookie-worker worker intercepts the request and fetches it from your
upstream site.</body> and the theme
CSS is injected into <head>.userConsent cookie, the banner is rendered hidden
and consent is applied immediately — no flash of the banner on repeat visits.userConsent cookie
valid for one year.