Skip to main content

Multiple Custom Domain for a single Mendix Node

This article gives instructions on how to set up multiple custom domains for a single Mendix Cloud Node.

Overview

This review assumes you have the a Mendix Licensed Cloud Node and you have two Custom URLs.

The application will first check the URL/hostname, then it will navigate the user to the appropriate page. Since the Mendix Navigation doesn't allow a call to a Nanoflow directly, it will first open a temporary page. Then the system will call a Nanoflow where it can retrieve the Hostname and direct the user to the correct landing page. To create a request for a Hostname click here.

Here's how to set up Multiple Custom Domain for a single Mendix Licensed Node.

  1. Create new home page
  2. Create nanoflow with JavaScript Code
  3. Configure your Production Environment

Create New Home Page

Create a new page (Home_GetURL) and on this page download the Microflow Timer widget from the app store and have it wrapped with an entity of your choice.

1. Download Microflow Timer Widget

Microflow Timer Widget

2. Create new page and add the microflow timer widget.

Page with Microflow Timer widget

Above I create a Timer entity without any attributes to remove the system errors.

3. Connect the microflow timer widget to call a nanoflow and follow the next steps to create and nanoflow.

Here is an example of the configurations of the Microflow Timer

Microflow Timer Configuration

Create nanoflow with JavaScript Action

4. Reference the image below and create a Nanoflow. You will create a new JavaScript Action which will retrieve the HostName, then you can navigate the user to the appropriate page.

Nanoflow Example

5. Create a new JavaScript Action and copy the following code between the Begin User Code and End User Code.

var thishost = window.location.hostname;
return thishost;

Here is an example:

JavaScript Code Example

6. Next update the Exclusive Splits to check for the Custom Domain names and do so for all all your checks:

  • Note – you need to check for {ProjectName}-accp so the user can navigate to each site when testing in Acceptance.
  • You can create a landing page for Acceptance and locally which allows a user to select which application they want to navigate to.

Here is an example of the Exclusive split and what the code should be.

Contains Example

7. Add the landing pages you want the user to navigate for each of the custom domains you have.

Changes in the Mendix Licensed Cloud Node

8. Navigation to the Mendix Sprintr to configure the Production Environment.

Once there navigate to the following path: {Project Name} > Environments > PROD Details > Network > Custom Domains

Custom Domains

Here is where you will create a New Custom Domain and link it to the Certificate added to the project.

  • Note - The Certificate should have been added when setting up your application for your first custom domain.

You have now successfully added navigation for multiple Custom Domains in your application.