Latest Posts

Set Up CloudFlare Workers to Use Your Own Domain

CloudFlare is the world’s leading provider of CDN solutions and domain name registration resolution solutions, and Workers is a serverless application based on its powerful CDN global cloud network.
Having previously shared a post about how to create a serverless reverse proxy using CloudFlare Workers, the long domain name ( created by this method is not suitable for sharing, so I was consider using my own domain name ( to access it. Searched online, but about this piece of information is quite written unclear and difficult to start, so here to make a note for my own reference.

As long as the CloudFlare CDN itself supports a domain name that can be used as a CloudFlare Workers domain name, it is important to note that the domain name needs to be hosted or pointing on CloudFlare, i.e. the name service of the domain name must be CloudFlare.

Configuration Steps

The main two steps are to add a custom domain name to the CloudFlare network and the other to associate the domain name to the Worker sub-domain name. There are no strict requirements for the order of these three steps.

1 Create a  sub-domain name 

As mentioned earlier, domain names, such as 51sec,org must be hosted on or pointing to CloudFlare, and other DNS registrars will result in various weird errors.
Domain hosting or pointing to CloudFlare is easy, create a dns A record and point to any valid ip address.

After a new DNS record is added, this A record name will be used for our Workers App's sub-domain. When adding this A record, name is the subdomain to be customized (such as The value of IPv4 address does not matter, but the key is to enable the Proxied.

2 Associated domain names to Workers

After you create Workers switch to your domain's Workers tab for the domain name (note that the domain name is here, where in Workers you won't find a place to associate it with your domain and then add the association to Add route

3 Create a Workers Route

Route fills in the subdomain with /*, (*) ,Worker selects the worker application we created before, who needs to customize the domain name access, so you need to create a Worker and then associate , to represent access to the Worker service through this custom domain name:*


When you’re done, you can access the  Worker service through a custom domain name, such as


To summarize, two key points:
  • The domain name must be hosted on CloudFlare;
  • The worker needs to be added as a route association after it is created;


No comments