Hi, I wanted to host a personal Lemmy instance online (for just myself, I don’t think I can take the upkeep for other users - please let me know if this is not possible) and wanted to understand how to “attach” a CDN service to it.

The idea behind doing this is that I’m in the US but I’m looking to host a server in Europe. I am looking into Cloudflare’s free CDN service, but it would be great if someone could point me towards how I can configure this setup to speed up the loading time for my Lemmy instance (which is going to be far away from me, geographically).

I would also like to know about your setups and how you have hosted Lemmy.

Thanks!

@MigratingtoLemmy@lemmy.world
creator
link
fedilink
English
01Y

Thank you for your comment. I’m going through the cloudflare docs, and I have a question: why do we need to change our nameservers to Cloudflare’s? I know this might sound like a noob networking question but I just can’t seem to figure it out. Thanks!

jjakc
link
fedilink
English
01Y

No problem! You change the name servers on your registrar to cloudflare’s so that when traffic goes to your.domain, cloudflare is the one that processes the dns request.

If you kept the name servers of your registrar then the traffic would just be processed by the registrar, cloudflare wouldn’t even see the traffic.

Basically the name server defines your domain’s current dns provider.

Hope that makes sense

@MigratingtoLemmy@lemmy.world
creator
link
fedilink
English
01Y

Ah, this is what I’m confused about. I get that traffic would need to flow through Cloudflare’s network, but why would Cloudflare require me to change my nameserver for that? How about a CNAME alias instead? What are the technical limitations for which Cloudflare asks this of me? I just want to understand the working behind them asking me to change my nameservers.

Thanks!

jjakc
link
fedilink
English
01Y

When you make a dns request, it goes to the nameservers first to see which server is has the dns config. A CNAME record is in the dns config

@MigratingtoLemmy@lemmy.world
creator
link
fedilink
English
01Y

I’m sorry, what I don’t understand is how does changing my nameservers to cloudflare’s nameservers help propagating my traffic through their CDN infrastructure?

jjakc
link
fedilink
English
0
edit-2
1Y

Because changing your nameservers to cloudflare’s allows you to use their DNS service, which comes with the CDN infrastructure.

Here is the cloudflare dns for my lemmy server’s domain:

The switch where it says proxied means that I am using the CDN to obfuscate the real IP of the server.

@MigratingtoLemmy@lemmy.world
creator
link
fedilink
English
01Y

Thank you, but I’m still having trouble understanding the technical reason for Cloudflare to require users to change their nameservers. Let me try and summarise what I understand:

When a user changes their nameservers to Cloudflare nameservers, all requests to the domain are routed to Cloudflare’s DNS endpoints. Because we are using a CDN (and are proxying traffic to our site through Cloudflare), the CDN endpoint (because it is the proxy) intercepts all traffic directed towards our domain. If we were to not change the nameservers for our domain to Cloudflare’s nameservers, Cloudflare would not be able to link our domain to the specific CDN endpoint it has likely set up for us at the back-end, which would defeat the purpose of the CDN and the proxying wouldn’t work.

Do I understand this correctly?

jjakc
link
fedilink
English
0
edit-2
1Y

Pretty much yes.

If you want a more in-depth explanation of DNS and how nameservers work etc check out this article from cloudflare.

Specifically the part; “There are 4 DNS servers involved in loading a webpage:” It explains it much better than I can.

@MigratingtoLemmy@lemmy.world
creator
link
fedilink
English
01Y

Thank you, I conceptually understand what nameservers (and their types) are, it’s just that I’m struggling a bit to link my understanding of DNS to how Cloudflare is proxying traffic through its own network. I assume that my previous comment had an OK explanation, a high-level overview of what happens.

Thanks for your time!

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 191 users / day
  • 419 users / week
  • 1.14K users / month
  • 3.85K users / 6 months
  • 1 subscriber
  • 3.71K Posts
  • 74.6K Comments
  • Modlog