- register domain with godaddy
- disable lock in Domain Settings > Additional Settings (otherwise cloudflare cannot take over)
- cloudflare: add domain
- godaddy: DNS > Manage Zones > provide name > Nnameservers > Change > provide 2 cloudflare DNS server addresses
- subscribe to workers unlimited plan (otherwise you cannot use workers sites)
Wrangler
- https://dash.cloudflare.com > select Domain > scroll bottom > copy Zone ID, Account ID
- https://developers.cloudflare.com/workers/tooling/wrangler/install/
- Settin up API key in wrangler needs the GLOBAL KEY!!!! > get your API token > Global API Key > View
- https://developers.cloudflare.com/workers/sites/start-from-existing/
Example .toml file
Worker will be named after the folder, not the
entry-point
!
name = "static-test"
type = "webpack"
account_id = "${YOUR_ACCOUNT_ID}"
workers_dev = true
[site]
bucket = "./src" # this can differ based on project
entry-point = "workers-site"
[env.production]
# The ID of your domain you're deploying to
zone_id = "${YOUR_ZONE_ID}"
# The route pattern your Workers application will be served at
route = "test.whatever.com/*" # this will create the worker if it does not exist yet
Routing Worker to domain:
initially you may need to wait a few seconds for workers to appear in cloudflare combo boxes
- select domain > Workers > Add Route
- Route: test.whatever.com/*
- Worker: ${FOLDER_NAME}-production
Adding sub-domain:
- select domain > DNS > Add Record
- Type: CNAME
- Name: test
- Target: @
- Proxy Status: Proxied