Custom Domain With Cloudflare


#1

I attached a pic. This makes blog.dalton.pro show:

“could not connect to project for blog.dalton.pro: 500 - {“stack”:“SyntaxError: Unexpected token u in JSON at position 0\n at Object.parse (native)\n at toUnsafeJSON (/opt/hyperdev/api/utils.coffee:63:21)\n at toSafeJSON (/opt/hyperdev/api/authorization.coffee:145:16)\n at /opt/hyperdev/api/init.coffee:30:13\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.


#2

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


#3

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.


#4

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?


#5

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?


#6

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!


#7

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.


#8

I have done this using fly.io

https://discord.theteamcoders.com/

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

Here’s a tutorial: https://fly.io/articles/fly-glitch/