158 words
1 minute
Assigning a custom subdomain to a Fly app
Anubhav Gain
2024-06-15

Assigning a custom subdomain to a Fly app#

I deployed an app to Fly and decided to point a custom subdomain to it.

My fly app is https://datasette-apache-proxy-demo.fly.dev/

I wanted the URL to be https://datasette-apache-proxy-demo.datasette.io/ (see issue #1524).

Relevant documentation: SSL for Custom Domains.

Assign a CNAME#

First step was to add a CNAME to my datasette.io domain.

I pointed CNAME of datasette-apache-proxy-demo.datasette.io at datasette-apache-proxy-demo.fly.dev. using Vercel DNS:

image

Issuing a certificate#

Fly started serving from http://datasette-apache-proxy-demo.datasette.io/ as soon as the DNS change propagated. To get https:// to work I had to run this:

% flyctl certs create datasette-apache-proxy-demo.datasette.io
Your certificate for datasette-apache-proxy-demo.datasette.io is being issued. Status is Awaiting certificates.

I could then run this command periodically to see if it had been issued, which happened about 53 seconds later:

apache-proxy % flyctl certs show datasette-apache-proxy-demo.datasette.io
The certificate for datasette-apache-proxy-demo.datasette.io has been issued.
Hostname = datasette-apache-proxy-demo.datasette.io
DNS Provider = constellix
Certificate Authority = Let's Encrypt
Issued = ecdsa,rsa
Added to App = 53 seconds ago
Source = fly
Assigning a custom subdomain to a Fly app
https://mranv.pages.dev/posts/assigning-a-custom-subdomain-to-a-fly-app/
Author
Anubhav Gain
Published at
2024-06-15
License
CC BY-NC-SA 4.0