Trying to use CNAME to redirect from a subdomain to a frontend canister

Here’s what the setup looks like

Domain that I’m trying to setup:

Canister I want to redirect to:

However, this is the error I’m greeted with when I try to visit that page

What other things I’ve tried:

  • On Cloudflare, I’ve tried turning off proxy mode
  • I’ve tried to point the domain to both <canister_id> and <canister_id>

Am I doing something wrong or is this not supposed to work like this? In case others had success redirecting their domains, please share how you’re doing it

Tagging @janeshchhabra as he suggested I post here during the Discord dev call

The boundary node needs the canister id in the request that reaches it; else it has no idea what maps to. So a simple CNAME doesn’t work (unless boundary nodes start resolving CNAMEs. Maybe that would work.)

I don’t know precisely what “proxy mode” means here. A certain kind of proxying (namely one that sets the Host header to should work I think. But then, you say it doesn’t, so not sure here.

Ah, currently you are forwarding to the non-raw URL. In that case, it’s the service worker that tries to find the canister id. And because that runs in the browser, the proxy doesn’t help.

1 Like


Rules Tab then:


What is the “$1” part for? in the canister URL?

Okay, I found the answer. For someone browsing in the future, it is to pass along the rest of the URL to the canister URL.

Cloudflare’s documentation for it lives here:

Are you adding anything to the DNS settings for the redirect rule you’ve setup here?

No, I removed most defaults.

Also yes the $1 lets you do things like:

Which will just pass the url to the canister url.


So, only this doesn’t solve it. It also requires you to add a DNS entry.

Basically, if you’re setting up a subdomain redirect, you also need to add the following to your DNS entries:

<subdomain_name> points to:
AAAA - 100::


A -

More details are available here at the Cloudflare docs

I come up with the following easy solution.


This requires placing a .htaccess file which means there is an Apache server hosted somewhere with Fleek using that to do the redirect. You’ll probably have a faster redirect using Cloudflare. But this will work also

sure, but this should be only a workaround until a finale solution will be provided.