Let's say I setup some subdomains and then point them to my home server via Cloudflare tunnel.

If I use one of those subdomains from my personal PC on the same network as my home server, to watch a movie for example, is all of that traffic going out to the internet and then back? Or does all the traffic stay internal once the connection has been made?

you are viewing a single comment's thread
view the rest of the comments
[–] 8 points 1 year ago (4 children)

yes, its also called hairpinning. to avoid this you can use a local dns resolver.

  • source
  • hideshow 4 child comments
  • [–] 5 points 1 year ago (3 children)

    Cloudflare tunnel likely terminates TLS on the edge. So if you bypass it, you don't have HTTPS. Not a problem locally, but then destroys the portability of the URL (because at home you need http and outside you need https). Might as well use different hosts then.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 6 points 1 year ago (2 children)

    You can use caddy to get internal https via cloudflare API, and no traffic needs to go through a cloudflare tunnel for that.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago (1 child)

    Possible, true. But then the setup also becomes more complicated. In addition you end up with different certs for local and remote access, which could cause issues with clients if they try to enforce cert pinning for example.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 1 year ago

    The (wildcard) certs are the same, as it's what caddy is pulling via API. You can either build the cloudflare module into caddy via docker build, or use a prebuilt version. It doesn't create two separate certs for local and remote.

    It works really well for me, and is actually the most straight forward way to get valid certs for internal services I've found. Since they're wildcard, my internal domains don't get exposed through certificate authorities.

  • source
  • parent