logo
### Getting Started with Your New Cloudflare Domain
This guide will help you set up your Cloudflare domain using a Cloudflare Worker, configure DNS settings, and set up email routing.
#### Steps
1. **Create a Cloudflare Worker**
- Navigate to the [Cloudflare Workers](https://workers.cloudflare.com/) dashboard.
- Create a new Worker.
- Name the Worker (e.g., `mydomain.account.workers.dev`).
- Replace the default code with the `worker.js` code provided below.
```javascript
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const redirectUrl = 'https://landingpagedomain';
return Response.redirect(redirectUrl, 302);
}
```
2. **Update the DNS Settings**
- Go to the DNS settings of your new domain on Cloudflare.
- Add a CNAME record:
- **Name:** `@` (or the root domain, e.g., `domain.com`)
- **Target:** `name.account.workers.dev` (replace with your Worker’s URL)
3. **Add a Route for Your Domain**
- On the Cloudflare dashboard, select your domain.
- In the left-hand menu, click on **Workers**.
- Under the **Routes** section, click **Add Route**.
- Set the route to `domain.com/*` (replace with your actual domain).
- Select the Worker you created earlier.
4. **Set SSL/TLS to "Full"**
- In the Cloudflare dashboard, select your domain.
- Go to **SSL/TLS** in the left-hand menu.
- Set the SSL/TLS encryption mode to **Full**.
5. **Set Up Email Routing**
- In the Cloudflare dashboard, select your domain.
- In the left-hand menu, click on **Email Routing**.
- Set up an email address (e.g., `hello@domain.com`).
- Forward emails to your preferred email address.
### Conclusion
Your Cloudflare domain is now set up with a Cloudflare Worker for redirection, DNS configured, SSL/TLS enabled, and email routing configured.
Write introduction
Discussion
You
0