Ability to directly link Cloudflare to Glitch app

I’m not up to date on DNS stuff, but I’m wondering whether there are technical limitations stopping Glitch from supporting a direct CNAME link (or any other sort) from Cloudflare? I’m using Glitch for some projects that get a lot of traffic, and so I really need a cache in front and thus can’t use custom domains directly.

On the Cloudflare forum a mod said this a couple of years ago:

We send the host header with the request. However the origin is not configured to accept the host header in the request which is your sub(domain). The same behavior occurs whether the record is proxied or passed-through.

It does not appear that glitch has a mechanism to designate additional supported CNAME aliases for the host. At Cloudflare unless you are on an ENT plan we don’t allow you to change the host header unfortunately for security reasons.

Is there any possibility of supporting a direct link between Cloudflare and Glitch? I’m currently using a “proxy” DigitalOcean server for all my projects, which isn’t ideal.

(Note: I know you can do this with Cloudfront, but it’s not free, and in fact is absurdly expensive if you have a decent amount of traffic/bandwidth. Also note that there’s a very old discussion about this here.)

Thanks!

What?
I have a regular domain (statcord.com) which goes through cloudflare.
beta.statcord.com is sent to glitch. Works fine

What?

This has been a problem with Glitch for a while.

beta.statcord.com is sent to glitch. Works fine

It looks like you’re pointing the CNAME at a non-glitch subdomain? (.preview.edge...)

When I try a CNAME record with a Glitch subdomain it gives the “project not found” page, which is what it has always done, as far as I know. I would be happy to be wrong here though! Perhaps it was fixed, and there’s some trick beyond a simple CNAME that you need to use?

Glitch doesn’t let you do this, probably because of how they internally handle the project DNS stuff.

Instead you have to use built in custom domains or fly.io (which doesn’t work for everyone).

Note: 2 Thanks are needed for built in custom domains.

2 Likes

You need to use the fly.io custom domain feature that’s built into glitch. That will give you a specific URL to put into cloudflare.

As @charliea21 mentioned above, you need 2 thanks to be able to use this feature.

2 Likes

Ahhhh, I see, thanks!

1 Like

Question: Does this method forward Cloudflare’s CF-Connecting-IP header? Or some other way to grab the IP of the user making the original request?

@joe Cloudflare have methods. We had a chat here:

and it seems that Glitch or fly.io mess with the IP anyway, so there is no way to get it on nodejs (I saw a package), but @RiversideRocks found a method for PHP :slight_smile: