#Umbraco URL generation in load-balanced environment

1 messages · Page 1 of 1 (latest)

digital crow
#

We have a controller that assembles a menu that is consumed by the frontend app. The menu includes the links to specific pages, i.e. login, registration and a menu structure of the content.

I build a model with the following linksConfig.RegistrationPage?.Url(null, UrlMode.Absolute) where RegistrationPage is IPublushedContent.

So I have a few pages here, but the URLs that I get are sometimes for Published and sometimes for Subscriber.

I tried to get this JSON response via https://my-webiste.com URL, but got back some of the links pointing to Publisher server (https://cm.my-website.com)

I have both domains specified in Domains and hostnames, but I would assume the first one or at least always the same one is used to generate URL.

How to make this predictable?

Thank you

mighty bay
#

From experience, don't rely on Umbraco UrlMode.Absolute to get things correct in a loadbalanced environment. Save yourself the headache and add an appsetting (global or environment specific depending on exact needs) for the primaryDomain and interpolate the urls in code from that. 🙂

#

(gets even worse if you have say azure.frontdoor in play.. as it does all the dns translations and umbraco might never even know about the primaryDomain)