This application demonstrates a simple, low-impact method to redirect a single reactive application to a custom domain, assuming that one or more custom domains have been added through the ODC Portal. The application uses an application setting to configure the custom domain, so different stages can use different custom domains for testing purposes. This does not affect the Module or Screen portion of the URL.
This is a demonstration of client-side redirection which is simple to implement and low impact, since it only affects the applications you include it on. You can also change your custom domains at any time using the Application Setting, with no code changes.
The method depends on the Request_ReplaceDomain server action from HTTP. The current URL is compared with the result returned from the Request_ReplaceDomain method, using the CustomDomain Application Setting. If the current URL is different than the calculated custom URL, the user is redirected to the custom URL.
BSD-3 license (https://opensource.org/licenses/BSD-3-Clause)