This is a template for making and deploying a really simple Cloudflare Worker.
There's no build step, so this is for things like redirects, simple proxies, etc.
The deployment step is not automatic in this template, since this is often used in private repos which don't have free workflow stuff. (Bitbucket does, fyi.)
You'll need to update the wrangler.toml
file with your own properties from Cloudflare.
Copy the configuration example to your own file:
cp configuration.example.sh configuration.sh
Then go to the Cloudflare dashboard to
generate a token, and set it in your configuration.sh
file.
Finally, simply run npm run deploy
For a subdomain, you'll need to add an AAAA
DNS record pointing to 100::
(the
reserved IPv6 discard prefix).
That comes from the cloudflare docs:
Subdomains must have a DNS Record
All subdomains must have a DNS record to be proxied on Cloudflare and used to invoke a Worker. For example, if you want to put a worker on
myname.example.com
, and you've addedexample.com
to Cloudflare but have not added any DNS records forexample.com
, any request tomyname.example.com
will result in the errorERR_NAME_NOT_RESOLVED
.To support this, you should use the Cloudflare dashboard to add an
AAAA
record formyname
toexample.com
, pointing to100::
(the reserved IPv6 discard prefix).