Automatically Forward To Application Through Custom URL

0
We've set a custom domain to our Mendix cloud environment https://example.customdomain.com and it's working perfectly; however, the application is still accessible through the default URL https://example.mendixcloud.com. We would like to have the default URL forward the user to the custom domain, and we would like it to be configurable (either fetch the currently linked custom domain, or to at least read it from a constant). We know how to do it using JavaScript on the homepage (that checks the current link and based on that decides if it should be forwarded to a hard-coded URL or to stay); however, this approach has downsides that we would like to avoid (like having to wait until the homepage loads, and like having to hard-code the target URL). Any Suggestions?
asked
1 answers
2

Perhaps javascript on the index.html and login.html pages would work for you? That would allow the redirect to happen very quickly.

You can edit those pages in the /theme/ folder in your project directory.

UPDATE:

I think your best bet may be to publish a REST GET endpoint that returns the correct URL. Then add JavaScript <script> tag to index.html with code that hits the rest service and gets the correct URL for the app. If the URL matches, there's nothing to do. If it doesn't match, then you can redirect.

 

answered