Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Håvard Hovind 9 posts 89 karma points
    Oct 05, 2018 @ 17:16
    Håvard Hovind
    0

    umbracoApplicationUrl and https

    Hi,

    I am forcing a redirect from http to https with iis rules.

    This is working fine, but it seems like the scheduled keepalive function in Umbraco returns an error, filling up the tracelog. Somehow my application url ends up as a http url.

    I understand that setting an https url explicit in umbacoApplicationUrl (in web.routing) could solve this.

    But, how can I do this dynamically? I have a lot of different environments (local + azure) with different URLs, and it would be great if it was possible to set this dynamically somehow, either through some kind of app service setting or if it just figured out whatever application url it has but using https instead of http.

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Oct 05, 2018 @ 19:37
    Marc Goodson
    100

    Hi Havard

    https://github.com/umbraco/Umbraco-CMS/blob/bfc627857db088172bf0508d15c86b4f3f441431/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs

    Essentially the rules for setting the umbracoApplicationUrl are that Umbraco will first look at the WebRouting settings, if this is blank it will look for the baseUrl (int the old scheduledtask settings) and then will look for any custom IServerRegistrar2 implementations that set the value in code, and finally it will just take the url of the first request the site receives after an application pool recycle.

    So if you want to set the value in code, based on some conditions on your site, then you can do this by leaving the WebRouting settings blank, and implementing an IServerRegistrar2 implementation:

    see https://our.umbraco.com/Documentation/Getting-Started/Setup/Server-Setup/Load-Balancing/flexible-advanced

    putting your custom logic for setting the value in the

    public string GetCurrentServerUmbracoApplicationUrl()
        {
    // return my url
    }
    

    method...

    but if the first request to the site is what you are after for the Url, then just leave all the config empty!

  • Håvard Hovind 9 posts 89 karma points
    Oct 05, 2018 @ 20:43
    Håvard Hovind
    0

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft