Managing the App
Settings

Custom Domain

10min

A domain name, also known as a URL or web address, is the digital location where visitors can find your site. Every site or web service hosted on Back4app Containers automatically receives a free, unchanging b4a.run address.

Each site hosted on Back4app can be accessed through its unique Back4app subdomain, taking the form of [appName-userName].b4a.run. However, Back4app also offers you the flexibility to use your own custom domains with our Containers feature.

Managing custom domains with Back4app Containers is straightforward. We oversee the creation of TLS certificates and automatically redirect HTTP to HTTPS for all your custom domains, including wildcard domains.

Utilizing custom domains gives you the opportunity to make your sites accessible via unique domain names like www.yourcustomdomain.com or docs.example.dev. We support all top-level domains for your custom domains. Let's explore how to establish your domains on Back4app Containers!

1-Register your custom domain

The first step in setting up your Back4App containers is to register a custom domain. You can do this through any domain registration service of your choice. If you have not yet registered your domain, please do so before proceeding with the next steps.

2- Add your Domain

Once you've registered your domain, you can add it to your Back4App containers. Here's how you do it:

  • Navigate to your app on Back4App Containers.
  • Go to Settings
  • Click on the Domain tab
  • Enter your registered domain in the provided field.
Add a Custom Domain
Add a Custom Domain


Following these steps, Back4App will provide instructions on how to add the records to your DNS server.

DNS Config Instructions
DNS Config Instructions


3. Configure DNS Server

This domain is now waiting for External DNS propagation (that can take up to 24 hours) or has not been configured properly. Confirm you have configured this domain properly with the suggestions below.

Recommended:
Point ALIAS, ANAME, or flattened CNAME record the given custom.b4a.run URL.

Create an ALIAS, ANAME, or flattened CNAME record for your domain pointing to the given custom.b4a.run URL. Examples:

Type

Name

Target

CNAME

www

123456.custom.b4a.run

ALIAS

@

13456346.custom.b4a.run

ANAME

mysubdomain

62345.custom.b4a.run

After adding the new records on your DNS server Back4app will validate the configuration and then will start to generate a SSL certificate. Notice that DNS propagation can take up to 24h.

4. Setting up Redirect Domains

You can also set up redirect domains on Back4App.

Redirect domains
Redirect domains


You can configure domain redirects to all domains configured on Back4app Containers to your App.



5-Custom Domain Config Example

Configuring the domain congnitivengine.com to reply as www.cognitivengine.com on Back4app Containers. In this example we will use CloudFlare as the DNS server.

5.1- Add the Domain to Back4app Containers

Add www.cognitivengine.com to the Back4app Containers and copy the given custom.b4a.run URL.

Document image


5.2- Configure the DNS Server for www.cognitivengine.com

Now, you need configure the DNS server to recognize your new domain. Create a new CNAME record using www on Name field and the given custom URL on Target. Check the image below.

CloudFlare DNS config
CloudFlare DNS config


After that, Back4App will detect the new DNS configuration, validate it, and then start the process of generating the certificates. Once the certificate generation and validation are completed, you will see a confirmation.

Domain Configured
Domain Configured


5.3- Configure cognitivengine.com as a redirect to www.cognitivengine.com

Now you can set up the cognitivengine.com domain as a redirect to www.cognitivengine.com.

Redirect domains
Redirect domains


Go to your DNS server and configure the root domain as described below:

  • Add a new CNAME record on your DNS server using these values.
  • Use the "@" symbol (which is used for root) and the address value generated by the Back4App domain.
  • Turn on the proxy option.
Document image


That's it! Now you've successfully configured your domain and subdomains on Back4App containers. Remember, each step is essential to ensure the correct functioning of your domain and subdomains.



Updated 23 Jan 2024
Doc contributor
Doc contributor
Did this page help you?