GuidesFlightcontrolCustom Domains

Custom Domains

This guide will show you how to connect a custom domain you purchased elsewhere with your service on Flightcontrol.

Setup Your Custom Domain

To connect a custom domain, you’ll need to follow these high-level steps:

  1. Add the domain to your Flightcontrol service configuration
  2. Retrieve the DNS changes needed for the domain redirect in the Flightcontrol dashboard
  3. Apply the changes to your domain provider

Add The Domain To Your Flightcontrol Service

The directions for adding a domain vary based on whether you are using the dashboard configuration or the flightcontrol.json file.

Using The Dashboard

If you created your project using the Dashboard, you can add your domain to the Custom Domain field of the associated service.

To find that field, go to the environment where your service resides, click on the service, then click the “Config” tab and scroll to the “Network configuration” section. When done, save the changes.

Using flightcontrol.json

If your project is configured using flightcontrol.json, you’ll need to add the domain configuration to your service. After you do that, push the changes to GitHub to trigger a new deployment.

DNS Changes

After the domain information is saved, we trigger a new deployment. Once this happens, the required DNS changes will be visible in the Flightcontrol dashboard, in the environment for this service.

They will look something like this if you have added a subdomain:

Required DNS changes shown by Flightcontrol in the dashboard for a subdomain

⚠️ If you add a root domain, you will also see information for an ALIAS record that you need to set. An ALIAS record is a custom DNS record and it is not supported by all providers. This is one of the reasons why we do not recommend root domains.

Apply Changes To Your Domain Provider

The specific instructions will depend on whether you are setting up a root domain or a subdomain.

For a Subdomain

The DNS changes for a subdomain are the most straightforward. As you can see from the screenshot above, you’ll get 2 CNAME records.

You’ll need to add those records to your domain provider.

Here are some guides from different providers:

For a Root Domain

With this option, things become less straightforward.

The most important thing to be aware of is that your domain provider NEEDS to support an ALIAS record, if they don’t you’ll need to move the domain to one that does or fallback to the subdomain option. If they do support it, then you should be able to set it up by adding the DNS records as shown to you by Flightcontrol (see external articles above with some examples).

However, please note that that Flightcontrol can’t verify if the ALIAS record was setup correctly since this record type is an internal translation and won’t appear in the nameserver response. So we only just check if CNAME is correct and assume the setup has been successful.

Lastly, if you have used Route53 as your domain provider, your domain needs to be in the same account as the service AND you’ll need to configure things slightly differently. When you create the ALIAS record, instead of using the CloudFront domain, you have to choose the exact Cloudfront distribution that was created by Flightcontrol.

Root Domain Recommendations

We have several recommendations if you are considering setting up a root domain (such as example.com).

Use the www Subdomain Instead of the Root Domain

We recommend you add a subdomain (i.e.: use www.example.com) instead of directly referencing the root domain (example.com).

If you go with this recommendation but still want users to be able to use example.com, please contact us and we will add a redirection for you.

Root Domain Requires ALIAS Support

If you still prefer to setup a root domain, make sure that it accepts an ALIAS DNS Record, which is a custom one not supported by all providers (Namecheap is one that does).

Wildcard Domains

Besides the 2 options discussed at length, we also support wildcard domains, i.e.: "domain": "*.example.com"

With this option you can make use of the HOST HTTP Request Header sent to your app to see the exact domain being used and the configuration is the same as for the subdomain.

FAQ

I have added the domain but still haven't made the DNS changes. Can I still access my service?

Why do you recommend using subdomain instead of root domain?