Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to use a Custom Domain with Replit
h
DillonB07

Using a Custom Domain with Replit

Introduction

Do you dislike your long repl.co domain? Or, do you want a more memorable one? Well, whatever the reason, this tutorial is for you!


There are many tutorials for this, but most of them are outdated and no longer work.
So, I thought I would create my own accurate tutorial!

Let's get started!

Creating your Repl

Well, I'll assume you already have a repl that hosts a web application.

  • If you are in a team, you must be the owner of the team to do this!
  • For a multiplayer repl, you need to be the owner of the repl

So, onto the next step!

Getting a Domain

Well, you obviously need a domain to add a custom domain to your repl!
For this tutorial, I'll be getting a free domain from Freenom, but you can get yours from anywhere.

Choosing your Domain

We're going to be getting a domain from Freenom.

Search for a domain you would like and click Get it now!, then Checkout Freenom is very slow to load. Be patient

If you can't use the Get it now! button, search for the domain with the extension on the end.

"Buy" your domain

Select the period you would like from the PERIOD dropdown. I recommend 12 months @ FREE if you want it for free. Then, click Continue. Now, complete your order after agreeing to the Terms and Conditions.

If you have never used Freenom before, you will be asked to create an account. Do this, and I'll see you on the next step.

Managing Domains

You can manage all of your domains under My Domains

Now, select your domain.

Setting up your Domain with Cloudflare

Now, we'll add our domain to Cloudlfare. You don't have to do this, though your website will be faster and more secure if you do do this. And it's free, so why not?

So, create or sign into a Cloudflare account.

Adding our site to Cloudflare

Now, we need to tell Cloudlflare what our domain is, and prove that it is ours.

Now, select a plan. I'll use Free.

It will scan for DNS records, and now is the time to link our domain to our repl.

Linking to your Repl

Go back to your repl. Click the pencil icon on the web preview and enter your domain.

Replit will give you a CNAME record. Copy that, because we will need it for the next step.

Go ahead and press Next

Make sure you keep the repl open or the linking process will stop.

Adding CNAME

Add a new record with the type being CNAME, the name being @ and the target is what you copied from Replit.

Changing nameservers

The penultimate step is here. We need to change our domain's nameservers for use with Cloudflare.

The nameservers you are given are random, and won't be the same every time. So, don't copy my ones, or ones that you have had in the past.

Now, link your domain on Replit.

Changing Security

The final thing to do is to change some Cloudflare security settings. You won't be able to access your website if you don't do this.

Go through the Quick Start Guide turning everything On This isn't necessary, but it provides a better experience to the visitors of your website.

Now, you need to go to SSL and select Full(Strict)

Finished!

We're all finished setting up our domain now. Head over to your URL, and give it a go!

I have been using this repl: @DillonB07/Custom-Domain-Demo and this domain: https://customdomaindemo.ml

I hope this tutorial was helpful. If you have any questions or issues, please leave them in the comments, and I'll reply as soon as I can.
If you have a suggestion for another post like this, also leave it in the comments, and I'll try and make it!

Voters
cloud9store
EdwardBentler
Saml2020
ruiwenge2
DillonB07
Comments
hotnewtop
MystPi

Great tutorial, just one thing:

So, create or sign into a Cloudflare (link has typo) account.

DillonB07

Thanks @MystPi Fixed it.

ruiwenge2

nice!

Saml2020

By the way, .tk domains do work on Cloudflare, I have a .tk domain on there. :p

DillonB07

@Saml2020
Thanks for the info, I'll update the post.