Each Web Service on FlexStack is assigned its own *.flexstack.app
address and its own CloudFront address *.cloudfront.net
that will not change as long as your service is active. In addition to these addresses, you can opt to use your own domain.
How it works
When you bring your own domain to FlexStack, we create a new ACM Certificate on your account with the domain you choose. The certificate will include the exact domain address and a wildcard subdomain address. That is, domain.com
will get a certificate for both domain.com
and *.domain.com
. This allows for efficient certificate re-use.
Add a custom domain to a web service
To get started, click on your web service on the environment overview page. Then, click on the "Domains" tab on the left.
Next, type the full name of the domain you want to add to the web service in the "Custom domain" field. For example "api.myproject.com" or just "myproject.com". Then click "Add domain".
Adding a domain via this form will trigger a DNS validation from AWS. At this step, you need to copy/paste the DNS records we provide to you into the dashboard of your domain registrar (e.g. Cloudflare, Namecheap, etc.). Below is an example validation for the domain ingest.theoretic.dev
.
It may take a few minutes for AWS to validate the domain, but once validated you will be redirected to the component overview page where you'll be able to track the deployment in real time. During the deployment, AWS will add your domain certificate to CloudFront and add the domain as a custom domain on the distribution.
When the deployment succeeds, you will immediately be able to access your service via the custom domain.
Update or remove a custom domain
After you've added a custom domain to your service, you will see a new fieldset in your web service's Domains tab. Here you'll find the CNAME record that you need to keep assigned to your domain, as well as buttons to change and remove the domain. When you change or remove a domain, your service will redeploy with the domain mapping removed.
Use custom domains with the Cloudflare registrar
Cloudflare is a popular domain registrar, CDN, and cloud. To use custom domains with Cloudflare, navigate to your website (e.g. theoretic.dev) in the Cloudflare dashboard, then follow DNS > Records in the sidebar on the left. Next, add the domain validation records by clicking the "Add Record" button on the page. Select CNAME, then copy/paste the name and target into their respective fields. Next, and importantly switch off the "Proxy status" toggle so that it shows the value "DNS Only". Then click "Save". An example is below:
Continue with the rest of the records we provided to you during validation.
Using Cloudflare proxy records with web services
To be able to use Cloudflare Proxy Records which enable several Cloudflare features, you need to do two things: disable caching and allow unencrypted HTTP traffic to your service. To do this, navigate to the "Deploy" tab in the sidebar of your component's dashboard.
Scroll the page down to the "CDN configuration" fieldset. Turn off "Always use HTTPS". Then ,turn on "Disable caching". To deploy these changes, click the "Deploy changes" button at the bottom of the page.