How to do Custom Domains with Fly

In Custom Domains with Fly, you’ll learn how to configure an NGINX server to proxy traffic to external sites and how to attach host and domain names to your Fly applications using Fly’s command line flyctl. For those of you who practice devops and

Dj Walker-Morgan
2 min readintermediate
--
View Original

Overview

The article provides a comprehensive guide on how to configure custom domains using Fly, including the use of NGINX to proxy traffic and the Fly command line tool, flyctl, for managing domains and certificates. It also highlights the capabilities of the Fly GraphQL API for automation and customization of Fly applications.

What You'll Learn

1

How to configure an NGINX server to proxy traffic to external sites

2

How to attach host and domain names to Fly applications using flyctl

3

How to use the Fly GraphQL API for managing hosts and certificates

Prerequisites & Requirements

  • Basic understanding of DNS and domain management
  • Familiarity with command line tools, specifically flyctl

Key Questions Answered

How can I add a custom domain to my Fly application?
To add a custom domain to your Fly application, you need to run the command 'flyctl ips list -a <app_name>' to get the IP addresses, then update your DNS provider with A and AAAA records for your domain. Finally, use 'flyctl certs create -a <app_name> <domain>' to create certificates for your domain.
What are the benefits of using Fly for custom domains?
Fly allows you to attach multiple certificates to an application, making it ideal for managing branded applications with custom domains. It provides features like auto-renewing Let's Encrypt TLS certificates, edge TLS, and HTTP/2 support, ensuring a fast and secure experience.
What is the role of the Fly GraphQL API in managing custom domains?
The Fly GraphQL API enables developers to automate the management of hosts and certificates, allowing for adding, removing, checking, and deleting domains programmatically. This is particularly useful for DevOps practices and automating deployment processes.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Web Server
Nginx
Used to proxy traffic to external sites.
Command Line Tool
Flyctl
Used for managing Fly applications, including attaching domains and certificates.
API
Graphql API
Used for programmatic management of hosts and certificates.

Key Actionable Insights

1
Utilize the flyctl command line tool to streamline the process of managing custom domains and certificates.
This tool simplifies the interaction with Fly's services, allowing developers to quickly add or modify domain settings without needing to navigate complex web interfaces.
2
Leverage the Fly GraphQL API for automating domain management tasks.
By using the API, developers can integrate domain management into their CI/CD pipelines, enhancing efficiency and reducing manual errors.
3
Ensure proper DNS configuration for your custom domains to avoid downtime.
Incorrect DNS settings can lead to accessibility issues for your applications. Always verify that A and AAAA records are correctly set before deploying.

Common Pitfalls

1
Failing to properly configure DNS records can lead to application downtime.
It's crucial to ensure that both A and AAAA records are correctly set with the provided IP addresses. Double-checking these settings can prevent accessibility issues.

Related Concepts

DNS Management
TLS Certificates
Devops Automation