foreword
Because of the workers.devDNS pollution incident yesterday, the default domain name suffix workers.dev of CFworkers was polluted by DNS across the board, so the default domain name of CFworkers has become increasingly unstable. We can use our own custom domain name to solve it.
Prepare materials
1. A domain name
2. A CloudFlare account
tutorial
1. Managed domain name
It is to transfer your domain name to CloudFlare and host it on CloudFlare. This is very simple. If you don’t know how to do it, you can use Baidu. If you don’t have a domain name, you can also refer to the tutorial Freenom to apply for a free domain name . domain name
2. Added DNS resolution
Add a DNS resolution in your own domain name, customize the name, fill in IPv4 as you like, and the most important thing is to open Xiaohuangyun (CDN)
3. Create Workers
The steps are the same as the original steps, tutorial: use CF to build Github download agent
4. Associate domain name
Go to your domain name, not your homepage! Enter Workers, add routing
Fill in the subdomain name + /* in the previous step for routing. For example, the domain name I just resolved through DNS is gh.xxxxx.cf, then fill in gh.xxxxx.cf/* in the routing column, and select the Worker that needs to be accessed by a custom domain name. It is what you just created in the third step. Note that you need to create a Worker first and then associate it, which means accessing the Worker service through this custom domain name:
After completion, you can access the Worker service through the custom domain name.
Summarize
To sum up, there are two key points:
the domain name must be hosted on CloudFlare
Worker, and the routing association needs to be added after creation