Custom home page/logic based on custom subdomain name

0
If I have two different custom domains pointing to the exact same environment using CNAME records   Eg: app1.test.com app2.test.com   Is there a way to set the navigation for the home page based on which subdomain/URL is currenty being used? Is there a way with a microflow that I can detect that I'm hitting the app via "app1.test.com" rather than "app2.tst.com"?
asked
2 answers
0

Perhaps this answer could help:

 

https://community.mendix.com/link/space/java-actions/questions/104006

answered
0

Brian,

Here is an approach I used:

  • Created a Javascript action that gets the URI that was used:
    // This file was generated by Mendix Studio Pro.
    //
    // WARNING: Only the following code will be retained when actions are regenerated:
    // - the import list
    // - the code between BEGIN USER CODE and END USER CODE
    // - the code between BEGIN EXTRA CODE and END EXTRA CODE
    // Other code you write will be lost the next time you deploy the project.
    import "mx-global";
    import { Big } from "big.js";
    
    // BEGIN EXTRA CODE
    // END EXTRA CODE
    
    /**
     * @returns {Promise.<string>}
     */
    export async function GetRedirectURL() {
    	// BEGIN USER CODE
    		window.addEventListener('DOMContentLoaded', (event) => {
        return window.location.href;
    	});
    
    	return window.location.href;
    	// END USER CODE
    }
    
  • Create a nanoflow that chooses a home page based on the contents of the URLimage.png
  • Created a page that uses microflow time to called this nanoflowimage.png
  • Set this page as the role based home page for anonymous usersimage.png

Hope that helps you get started,

Mike

answered