Custom domains using your own reverse-proxy!

Hello fellow Glitchers!

Today I’ve made a little tutorial on how you can create custom domains using your own reverse-proxy.

What this does is allowing you, regardless of how many ‘thanks’ you have, create custom domains on glitch. With this you also have the power to change, modify and/or delete your custom-domains without having to contact a glitch moderator.

Requirements:

  • This requires your network to expose port 80 and 443.
  • Docker and Docker Compose.
  • Your very own domain (if you’d like a free domain you can also visit Freenom)

Why

  1. That sexy key-lock (HTTPS) before your domain.
  2. No need to ask moderators to remove your domain if you want to use it elsewhere.

How

See video. If you absolutely need a step by step tutorial in text you can tag me and I will write it :wink:

Enjoy your custom domain freedom!

5 Likes

Custom Domains through Glitch do support HTTPS, they just don’t automatically upgrade a HTTP request to an HTTPS request, although this is overcome by having your Glitch project redirect a HTTP request to it’s HTTPS counterpart.

Opening up ports, especially the common ports for web traffic, on a home network for a personal computer is in my opinion a bit of an unnecessary security risk. Not to mention the reliability problem, the computer would need to be up 24/7, and you’d be relying on your ISP not changing your IP address too often. If I were going to do this I think using a cloud provider’s VMs makes a lot more sense.

2 Likes

I did not know that Glitch offered SSL certificates on demand.

I also mentioned in the video that I neither think it’s a good idea to have a reverse-proxy hosted locally, I said it was possible.

Thanks for the comment though!

When making that video I actually was in a SSH on my VPS from Contabo.

2 Likes

No problem! I love seeing people iterate on top of various platforms. I also had no idea that Freenom is where people get all these wild domain extensions, I’m going to have to find a use for some of these :sunglasses:

3 Likes

Freenom offers these TLDs for free: .tk, .ml, .ga, .cf, .gq

I’ve used freenom before to get a free domain for some of my smaller projects :wink:

1 Like

I usually subdomain small stuff off my personal domain until it proves itself worth it’s own domain (and after I’ve changed the name 6-11 times).

I’ve never heard of Contabo but this setup could definitely also work on AWS within the bounds of the free tier so this would be completely free for the first year.

1 Like

Contabo is probably the cheapest VPS hosting firm you’ll ever get into, their support is amazing, prizes are awesome, and performanse is also amazing. Sorry for the off-topic btw :joy:

1 Like

or just wait until you get two thanks and do it the normal way

1 Like

I have nothing against that. But that is not the main reason for using your own reverse-proxy. Every time I go onto these forums I see a new post about domain removal, or some mistake with custom domains. Using a custom reverse-proxy allows you to not rely on Glitch to remove your domain so you can re-use it elsewhere or for any other reason rely on Glitch for your domain to work.

Would this work on a rasberryPi?

I don’t see why not. Based on experience, it should work.

1 Like

Depending on the amount of requests, sure, but if you have too many keep-alive http connections it might be little bit too much. Otherwise I think it should work fine :wink:

I also have made a reverse proxy myself called Proxo. Here’s my idea. Heroku gives you custom domains if you verify with a credit card and we can use it since we don’t need persistent storage. However there’s a specific number of hours you can run it. So if you run the reverse proxy on heroku you can setup custom domains without fly.io. Plus you can modify stuff like the loading screen and cache requests.

I doubt this would be possible, but can you set up a custom domain without the reverse proxy?

No because glitch notices that you are trying to access the project from adomain.com and not something.glitch.me and says “nonononono I don’t think you’re allowed to do that”

@javaarchive Not exactly.
Say your domain is example.com. You setup a reverse proxy, tell the reverse proxy to proxy example.com to example.glitch.me.

The issue here is that if you don’t do it properly (setting the host header from the reverse proxy to the endpoint, glitch in this case), glitch’s reverse proxy doesn’t have a single clue on what container to contact.

So as long as you set the host header to be your subdomain and glitch.me (example.glitch.me) you’ll be fine.

Example of bad reverse proxy config for caddy:

example.com {
    reverse_proxy https://example.glitch.me
}

What happens in the above example is that Glitch receives your request, but the Host, or the domain, is not a valid glitch.me domain, therefore the reverse-proxy is not able to find a corresponding container to forward the request to.

A good config would look something like this, where the host header is modified to send a valid glitch.me subdomain:

example.com {
    reverse_proxy https://example.glitch.me {
        header_up Host example.glitch.me
    }
}
3 Likes

I am not really sure, but I heard that .tk displays adult content after a year or so…

Needs to be confirmed though!

I believe that freenom can redirect your domain… maybe not adult content but maybe a website like freenom.link

1 Like

If you order a free .tk domain you are in complete control of the domain, Freenom’s goal is that “there is a name for everyone” or something like that. Freenom cannot and even could not display adult content on your domain even if they wanted to. That would technically be impossible with how the web works.

I’ve been using freenom (or dot.tk) for about 2-3 years and I’ve never had any issues with them.

1 Like

That isn’t 100% true. When you get a free domain from freenom, unlike other domain vendors, you do not have full rights to it. You simply have a silence where they are in control.