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.
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:
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.
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
method...
but if the first request to the site is what you are after for the Url, then just leave all the config empty!
Thanks!
is working on a reply...