Custom Domain With Cloudflare

I attached a pic. This makes show:

“could not connect to project for 500 - {“stack”:“SyntaxError: Unexpected token u in JSON at position 0\n at Object.parse (native)\n at toUnsafeJSON (/opt/hyperdev/api/\n at toSafeJSON (/opt/hyperdev/api/\n at /opt/hyperdev/api/\n”,“message”:“Unexpected token u in JSON at position 0”}”

It’s not working. Has anybody on here managed to get it working? If so please share a tutorial for Cloudflare specifically.

1 Like

Thanks for the report, we’ll add it to our list of things to investigate!

1 Like

Yeah, until they implement custom domain support server-side, a simple CNAME is not going to be sufficient.

The CNAME tells the dns to resolve it to the same ip as your glitch domain, but your browser still sends the Host header for the custom domain. Glitch’s load balancer doesn’t recognize it and doesn’t know which app you want.

I really wish we could specify a domain name like on github pages, and have glitch route that to my app.


In the meantime you can use CloudFront which does use the Host header of your Glitch app, here’s a tutorial with some more info: How do I assign a custom domain?

1 Like

Cloudflare can sort of do what is needed with a “Host Header Rewrite” page rule, but that is only available to enterprise customers. Cloudfront is also not a free option, so I hesitate to even try it. Is there any estimate at all if or when this will be available natively in Glitch?

Just putting my two cents in here but custom domains would really be extremely appreciated! The CloudFlare solution doesn’t seem to work and setting up a CloudFront solution takes more time and costs more than proxying things through my own nginx (and touching my own server is kind of what I’m trying to avoid) :smiley:

Anyway, thanks for an awesome service!


Hey y’all. I’m working on a service that would make custom domains and even multiple glitch projects on the same domain easy. It’s called Routepath, and it should be launching in a couple months.

1 Like

I have done this using

Is hosted on Glitch, but using Cloudflare CNAME, CNAME to hostname.

Here’s a tutorial: