Hosting on custom domain

In order to 'host' your Web App on a custom domain, the following is required:

  • A domain, as well as access to the domain's DNS settings.

  • A published Web App, either Preview or Production.

As you may have noticed, 'host' is written in parentheses. This is because this article does not explain how to actually host the Web App on your own domain, but how you can make it appear as if your Web App is hosted on your own domain. The way we're going to achieve this is by adding either a CNAME or ALIAS record to your domain's DNS settings.

Before we start, let's first explain the terms CNAME and ALIAS so that you have a better understanding of what we're doing here.

'Hosting' via CNAME

CNAME records can be used to alias one name to another. Take for example these two URLs:

URL #1: appmachine.com URL #2: www.appmachine.com

Both addresses point toward the same application and are hosted by the same server. However, only appmachine.com points towards the server IP address. The prefix (subdomain) to the other URL www. is actually a CNAME record that points towards appmachine.com.

Now, let's say we've created a Web App with AppMachine which is published on the URL 1234ab.myinstant.app. If we create a CNAME record for webapp. within the appmachine.com DNS settings, and point it towards 1234ab.myinstant.app, then we will be able to view our published web app by navigating to the URL webapp.appmachine.com.

'Hosting' via ALIAS

An ALIAS provides CNAME-like behaviour, but does so on the apex domain rather than on the subdomain.

Let's say we have our published Web App 1234ab.myinstant.app again, and this time, instead of webapp.appmachine.com, we want appmachine.com to display the published Web App. Because we want to point the apex domain toward a different domain, we use an ALIAS with the name appmachine.com and point it towards 1234ab.myinstant.app.

When to use which?

Generally speaking, if you've bought a domain for the sole purpose if displaying your Web App, and you wish for your app to visible on the apex domain URL, then you'll use an ALIAS to accomplish this.

If you already have a website and you wish to make your Web App available via a subdomain on the same URL, then you use a CNAME to accomplish this.

Linking your domain

To link your domain to your AppMachine Web App, open the Web App info page in AppMachine and click the 'Link custom domain' button.

Next, enter the domain on which you'd like the Web App to become visible. This can be a subdomain if you'll be using a CNAME-record, or the apex domain if you're using an ALIAS.

Finally, login to your domain's control panel and open the DNS settings page. Depending on your choosing, add either a CNAME or an ALIAS to your DNS settings with the record name and value displayed in AppMachine.

After clicking the Finish button, our systems will check whether the domain you've provided can be reached, and whether the references have been configured correctly. If everything checks out, the Custom DNS status on your Web App info page will state 'Linked'.

Last updated