UmbracoApplicationUrl is not applied in Azure App Service environment

Hi,

I’m using latest Umbraco v13 on Azure App Service and it is behind Azure Front Door.

I have set the UmbracoApplicationUrl in the config but it is not used when I access the CMS backend.

appsettings.Production.json

   {
    "Umbraco": {
      "CMS": {
        "Runtime": {
          "Mode": "Production"
        },
        "Global": {
          "UseHttps": true
        },
        "ModelsBuilder": {
          "ModelsMode": "Nothing"
        },
        "WebRouting": {
          "UmbracoApplicationUrl": "https://example.com/"
        }
      }
    }
}

When I access https://example.com/umbraco, it redirects to https://example.azurewebsites.net/umbraco/login

I can access with https://example.com/umbraco if it is not Production runtime and UseHttps is false.

Any ideas how to solve it?

Thanks.


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/113607-umbracoapplicationurl-is-not-applied-in-azure-app-service-environment

I believe I see see the same - has anyone got the UmbracoApplicationUrl to work, so absolute URLs are always resolved according to this?

I do have a work-around, but prefer this to be the one used for content delivery and that kind of resolvements.

My work-around:
In backoffice, use “Cultures and Hostnames => Domains” for root page to control it.

I haven’t solved for resolving image-urls yet. with code like this:

        IPublishedContent? imageValue = image.Value<IPublishedContent>("image");
        string? imageUrl = imageValue?.Url(mode: UrlMode.Absolute);

.Url(...) is from Umbraco.Extensions.FriendlyPublishedContentExtensions

That’s not what this setting is for. It sets the Umbraco “application” URL, i.e. the URL for the Umbraco instance that’s running your site. Not the URL for the website itself.

From the docs:

Also ensure the UmbracoApplicationUrl is updated to the primary URL of your production environment, as this is used when sending emails (password reset, notifications, health check results, etc.).

Umbraco will pick this based on first request but for multilingual/domain/subdomain sites, or on azure, this may be wrong, which is why it’s required to set it explicitly for production.

This isn’t a workaround. This is how domains are assigned to content in Umbraco and is the correct way to ensure that .Url(mode: UrlMode.Absolute) returns the domain you want.

1 Like