Umbraco URL generation in load-balanced environment
g
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 https://cdn.discordapp.com/attachments/1282680052936343614/1282680053267828748/image.png?ex=66e03c63&is=66deeae3&hm=a6b2b0d0df17421c2e38f705c2d94b14e9ce68914c72e3462c81ae78e77798aa&
m
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)
k
Just piling on to agree with @Mike Chambers We just do a "Domains" key on our appsettings ´´json "Domains": { "Backend": "https://somethingsuperdupersecret.finansforbundet.dk", "Frontend": "https://finansforbundet.dk" }, ```
5 Views