Disable the default domain

I just set up a custom domain for my app, how do I disable now the default [app].fly.dev domain, so the app is available only on the custom domain? Is that something I can do only on the app level (e.g. a force redirect), or there is a setting somewhere?

1 Like

Someone else may correct me, but I don’t think one can disable the default appname.fly.dev domain for a publicly accessible app.

You can redirect HTTP if the Host header doesn’t match what you’re expecting, but I don’t see much value in doing so, tbh, as this solution is specific to just HTTP.

Curious though, if I may, what’s the reason behind wanting to make the service inaccessible over fly.dev?

You can redirect HTTP if the Host header doesn’t match what you’re expecting, but I don’t see much value in doing so, tbh, as this solution is specific to just HTTP.

I’m probably going to implement the redirect on the app level when I’m back to it.

Curious though, if I may, what’s the reason behind wanting to make the service inaccessible over fly.dev ?

The reason is that it’s a content site and I presume (which might be wrong because I’m not good at it) it’s bad for SEO when the same content is available on two different domains.

I’d imagine they want to use some managed proxy layer like cf for authentication or bot management

1 Like

There’s no way to disable the fly.dev at the moment, but you can set up a 403 or whatever response you need from within your app. I think there are two general ways to do this:

  1. Set up two Fly apps – one for your “app app” and another running a web server like Caddy, Nginx, etc. Set up Caddy/Nginx to proxy requests to your app over the Fly.io private network.

  2. Figure out how to include the web server and app into the same Dockerfile. I’ve only tried this method with my static site where I redirect all requests for *.fly.dev to my custom domain.

2 Likes

Are you considering adding this feature (do disable the .dev domain)? While the .dev domain is sweet for development, etc. I would assume that most production apps would prefer not to be reachable on a .dev domain?

2 Likes