Serve fly.io app from subdomain of existing TLD

I have an existing domain, nashvilletabletopday.com, which currently points to my single page on my WordPress site (Nashville Tabletop Day 2024 — Meeple Mountain). This is an event I run here in Nashville.

I’d like to see if it’s possible to serve my Fly app from event.nashvilletabletopday.com, without affecting the existing redirect. I currently have web-forwarding enabled for both the TLD and wildcards.

Obviously I’ll need to remove the wildcard, but can someone help me understand what else I’d need to do in order to accomplish this? DNS setup isn’t really my strong suit. The Fly docs seem to indicate that it could be as simple as

flyctl certs create "*.example.com"

But I imagine that I’d still need to do something with my registrar in order to point wildcard traffic at Fly? I think that’s the part I need to figure out.

Hi,

As far as I can see http://event.nashvilletabletopday.com/ currently does take you to https://www.meeplemountain.com/nashville-tabletop-day/ so if that is what you mean, you may have already solved this.

However if you want http://event.nashvilletabletopday.com/ to not do that (and instead be a separate site) you are correct in that you would need to:

  1. Tell Fly about that custom domain. Else when it receives a request arrive for event.nashvilletabletopday.com it wouldn’t know which app should handle it. You tell it by creating the cert, like you say, which tells it, ah, that’s my app and my cert, and so here’s what should be handling that.

  2. At this point Fly knows how to handle a request at its edge for event.nashvilletabletopday.com. But no request ever will. Since your existing DNS records (pictured) would never send one to it. All requests would match your wildcard address and so visitors to event.nashvilletabletopday.com would be redirected to the forward address. You would need to add another DNS record to your registrar that exactly matches event.nashvilletabletopday.com. And the value of it would be either a CNAME to your-app-name.fly.dev OR an A record to the IPv4 of the Fly app.

What would then happen is requests for event.nashvilletabletopday.com would match that, and be handled by the Fly app. Requests for something-else.nashvilletabletopday.com would not match that, and so would instead match your wildcard record.

I’m not sure what registrar you are using however that’s normally how it works. Exact matches should take precedence over wildcard matches.

1 Like

@greg I think this is the push I need to just try it. I tend to be a bit risk averse with environments and I’d usually rather just let things be than mess it up. :smiley:

That said, I think I can just delete the custom stuff if it goes wrong.

1 Like

okay. I’ve got event.nashvilletabletopday.com pointing to my fly app: nashville-tabletop-day.fly.dev. And when I believe I’ve got the cert awaiting build.

$ fly certs list
Host Name                 Added                Status
event.nashvilletabletopday.com 10 minutes ago       Awaiting certificates

So now it looks like I just need to wait a bit.

Great!

It’s possible you will also need to add an extra DNS record to verify you own that custom domain. So if the certificate does not get issued, that’s likely why.

If you scroll down a little bit here Custom Domains and SSL Certificates · Fly Docs you will see that they illustrate that additional record. It’s an “acme challenge” DNS record pointed to e.g example.abcde.flydns.net. You should be able to see the extra DNS record for your app in your Fly dashboard (or by using the Fly CLI, as shown in the docs). But that may not be needed. Just something to try if you still don’t have a cert by now.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.