Hi, I’m working on setting up Cloudflare to enable dynamic metadata Dynamic page metadata | WeWeb Documentation, but there’s a gab in the videos for which I don’t know what to do. @Slavo mention that the domain was purchased through GoDaddy. I did the same, but I’m not entirely sure which DNS settings I should configure in GoDaddy versus in Cloudflare. Should I just add Cloudflare’s nameservers in GoDaddy and handle all the DNS settings directly in Cloudflare? That’s what I’d expect, but WeWeb’s tutorial only mentions the service worker in the DNS and nothing regarding the CNAME we need to create to activate the custom domain on Weweb, so I’m a bit confused. Thanks!
I found the solution to my issue. To make it work, I had to delete my custom domain from the WeWeb Custom Domain configuration and follow the steps exactly as shown in the video. The service worker is actually responsible for handling the custom domain, not the “traditional method” in WeWeb’s Domain settings. In the config.js
file, I then added my WeWeb default app preview link in the domainSource
setting (the one that finished by …weweb-preview.io).
Also, for information, the only thing I did in GoDaddy was to create custom nameservers and added both nameservers from Cloudflare.
Super interesting! I could not make it work when I followed that document. Is that only change you made?
The main step was to remove the custom domain configuration within WeWeb:
And then publish directly on Weweb preview like this:
Additionally, since the setup is only working on the root domain, I wanted to ensure users can type “www” without being blocked. To make this possible, I added a new DNS record in Cloudflare:
- Type: CNAME
- Name: www
- Content: @ (or you can directly type your root domain, e.g., mydomain.com)
- Proxy Status: Proxied (orange cloud)
- TTL: Auto
Next, I navigated to the Rules section, selected Redirect Rules, and applied a template called “Redirect from WWW to Root [Template].”
For additional precaution (though I wasn’t entirely sure if it was needed), I also went to Rules > Page Rules and set up the following:
URL: http://www.mydomain.com/*
Select Status Code: 301 - Permanent Redirect
Destination URL: https://mydomain.com/$1
Note: Replace mydomain.com with your domain name.
When all done, typing either your preview site URL or your custom domain URL will work.
I think that’s all I did. Let me know how it works for you, and feel free to send any screenshots of your setup if you need further help.
For your info, I used ChatGPT to find the solution. I have a paid account, so I could ask questions but also upload screenshots for each step and it allowed me to fully understand the logic behind it. That’s how I was able to figure it out!
Super awesome! thanks so much for very detailed explanation. that is really helpful!