Mapping a domain to vercel or digitalocean

What I’m trying to do seems very basic, but can’t get it to work without help.

I have Cloudflare manage my domain, say mydomain.com.
I set its origin to myapp.vercel.app

When I browse mydomain.com, I get a Vercel error “404: NOT_FOUND, Code: `DEPLOYMENT_NOT_FOUND”.

I guess this makes sense, since Cloudflare accesses the Vercel servers with host header mydomain.com, which Vercel doesn’t know. (it expects myapp.vercel.app as host).

How can I make Cloudflare use myapp.vercel.app as host header instead when it contacts the Vercel server?

I see this is possible with Cloudflare “Origin Rules”, but these are only available to Enterprise users.
Surely a basic feature as protecting your Vercel or Digital Ocean site with Cloudflare should not require Enterprise?

I think I’m missing something and approaching this the wrong way.
Any suggestions?

Thanks!
Franky

Changing the host header would allow you to point any domain at a site through Cloudflare and be a potential channel for attack bypassing site protections. If you pay for an Enterprise account, you aren’t going to doing that sort of thing.

You will either need to add your domain name to Vercel or just redirect to it.

Thanks for the quick and helpful reply!

I can indeed add the domain name to Vercel, but this only works with mydomain.com, which is handled by Cloudflare.

The problem is that I want to add many Custom Domains for my customers as well (using Cloudflare for Saas). If I have to add all those to Vercel as well, I run into the problem that I’d have to ask the customers to CNAME their domain either to:

  • myapp.vercel.com, which would make Vercel happy but then the customer’s domain would be directly using the vercel origin server and not cloudflare
  • fallback.mydomain.com which would correctly use cloudflare, but then vercel would complain that the CNAME is not pointing to them.

Any solution for this?

Many Thanks!
Franky

Still stuck with this. Really no suggestions?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.