Create an Azion custom domain
Give a workload a free azion.app hostname that Azion serves over HTTPS, from Azion Console, the Azion CLI, or the API.
You can give a workload a free hostname under azion.app from Azion Console, the Azion CLI, or the API. To serve a domain you own, such as www.example.com, refer to Add a custom domain to a workload instead.
The Azion custom domain is a hostname you choose, in the form <your-name>.azion.app, such as my-custom-name.azion.app. It differs from the workload domain, the <id>.map.azionedge.net hostname that Azion generates when it creates the workload. The workload stores the Azion custom domain as one entry of its domains, beside any domain you own. The Azion custom domain is available at no additional cost.
Choose an interface. Each task below shows the prerequisites and steps for your choice.
Prerequisites
- A workload on the production infrastructure whose deployment names an application. A staging workload takes no Azion custom domain. To create the workload and its deployment, refer to Workloads quickstart.
- A name that no other workload holds under
azion.app.
- Access to Azion Console. For more information, refer to How to access Azion Console.
Add the Azion custom domain to the workload
The workload answers on the Azion custom domain once the full hostname is in its domains. You choose only the name: the suffix .azion.app is fixed.
To add the Azion custom domain with the Azion CLI, save a JSON file with the workload ID and the domains list, here as azion-app.json. Keep every domain the workload already lists in the same list:
Update the workload with the file:
The command prints the ID of the updated workload:
To confirm the change, describe the workload:
This excerpt of the output lists the Azion custom domain in domains, apart from the workload domain:
The API stores the name with the case you send, so My-Site.azion.app reads back as My-Site.azion.app. The change is refused in four cases, each with its own message:
- A second
azion.apphostname on the same workload. A workload holds one, whether the list repeats a name or carries two names:Duplicated usage of suffix in alternate_domains: 'azion.app'. - A name that another workload holds. An
azion.appname belongs to one workload and is not shared between accounts or configurations:The custom hostname is not available. - A wildcard name, such as
*.azion.app:The domain does not conform to the format defined in RFC 1035. - A staging workload. The Console turns off the Custom Domain switch and makes it unavailable, and the CLI and the API return
Custom hostname is not available in the environment 'Staging Infrastructure'.
For the causes and fixes, refer to Troubleshoot Workloads.
Open the Azion custom domain
The Azion custom domain needs no DNS record from you and no certificate of yours. With tls.certificate set to null, the default, the workload serves HTTPS with the Azion SAN certificate, which covers the Azion custom domain and the workload domain. For more information, refer to How Workloads works.
A workload change takes several minutes to reach all of Azion’s distributed infrastructure. Until the change arrives, a request to https://<your-name>.azion.app answers 404 with Azion’s HTML error page. Requests can receive the old or the new configuration for a while, so repeat a request until the answers agree.
Once the change propagates, a request to https://<your-name>.azion.app reaches the application in the workload’s deployment and returns its response, such as 200.