til: fly_custom-subdomain-fly.md
This data as json
| path | topic | title | url | body | html | shot | created | created_utc | updated | updated_utc | shot_hash | slug |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fly_custom-subdomain-fly.md | fly | Assigning a custom subdomain to a Fly app | https://github.com/simonw/til/blob/main/fly/custom-subdomain-fly.md | I deployed an app to [Fly](https://fly.io/) 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](https://github.com/simonw/datasette/issues/1524)). Relevant documentation: [SSL for Custom Domains](https://fly.io/docs/app-guides/custom-domains-with-fly/). ## 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: <img width="586" alt="image" src="https://user-images.githubusercontent.com/9599/142740008-942f180b-bedb-4a44-b6ef-1b0e7fd32416.png"> ## 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 ``` | <p>I deployed an app to <a href="https://fly.io/" rel="nofollow">Fly</a> and decided to point a custom subdomain to it.</p> <p>My fly app is <a href="https://datasette-apache-proxy-demo.fly.dev/" rel="nofollow">https://datasette-apache-proxy-demo.fly.dev/</a></p> <p>I wanted the URL to be <a href="https://datasette-apache-proxy-demo.datasette.io/" rel="nofollow">https://datasette-apache-proxy-demo.datasette.io/</a> (see <a href="https://github.com/simonw/datasette/issues/1524">issue #1524</a>).</p> <p>Relevant documentation: <a href="https://fly.io/docs/app-guides/custom-domains-with-fly/" rel="nofollow">SSL for Custom Domains</a>.</p> <h2> <a id="user-content-assign-a-cname" class="anchor" href="#assign-a-cname" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Assign a CNAME</h2> <p>First step was to add a CNAME to my <code>datasette.io</code> domain.</p> <p>I pointed <code>CNAME</code> of <code>datasette-apache-proxy-demo.datasette.io</code> at <code>datasette-apache-proxy-demo.fly.dev.</code> using Vercel DNS:</p> <p><a href="https://user-images.githubusercontent.com/9599/142740008-942f180b-bedb-4a44-b6ef-1b0e7fd32416.png" target="_blank" rel="nofollow"><img width="586" alt="image" src="https://user-images.githubusercontent.com/9599/142740008-942f180b-bedb-4a44-b6ef-1b0e7fd32416.png" style="max-width:100%;"></a></p> <h2> <a id="user-content-issuing-a-certificate" class="anchor" href="#issuing-a-certificate" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Issuing a certificate</h2> <p>Fly started serving from <code>http://datasette-apache-proxy-demo.datasette.io/</code> as soon as the DNS change propagated. To get <code>https://</code> to work I had to run this:</p> <pre><code>% 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. </code></pre> <p>I could then run this command periodically to see if it had been issued, which happened about 53 seconds later:</p> <pre><code>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 </code></pre> | <Binary: 65,055 bytes> | 2021-11-20T12:46:43-08:00 | 2021-11-20T20:46:43+00:00 | 2021-11-20T12:46:43-08:00 | 2021-11-20T20:46:43+00:00 | f70fecfe6cfda21a079a753a1b96d491 | custom-subdomain-fly |