CloudPlatform for Azure App Service was added in Pull Request #25829, but the environment is not correctly identified on App Service (Windows) because the WEBSITES_ENABLE_APP_SERVICE_STORAGE environment variable, which exists only on App Service (Linux), was used to identify the environment.

https://github.com/spring-projects/spring-boot/pull/25829#issuecomment-811026991

Therefore, if you are running a Spring boot application on Windows, you may need to configure additional settings for handling Forwarded headers.

There are a number of environment variables that exist on both Windows and Linux, but the following three are probably unique to Azure App Service.

  • WEBSITE_INSTANCE_ID
  • WEBSITE_RESOURCE_GROUP
  • WEBSITE_SKU

Hello @jdubois, I would like to know if you have any opinions on this.

Comment From: wilkinsona

Thanks for raising this, @shibayan. When the original support was added, I shared @cuspymd's concern that WEBSITE_SITE_NAME was too generic to use on its own. I have similar concerns about WEBSITE_INSTANCE_ID, WEBSITE_RESOURCE_GROUP, and WEBSITE_SKU. Ideally we'd find another environment variable that's more Azure-specific while also being present on Windows.

Let's wait for the opinion of @jdubois before we change anything here.

Comment From: jdubois

Thank you! I’ll have a look next week, when I’m back from holidays.

Comment From: jdubois

I just had a talk with @ccompy who knows this far better than I do, and those three environment variables look good. I'm going to do a PR to fix this in the next couple of days, if that's fine with everyone.

Comment From: wilkinsona

Thanks, @jdubois. I'm still a bit concerned about false positives as those three are all rather generic. If there's no single alternative that's more Azure-specific, I guess my concerns could be alleviated somewhat by looking for all three in combination.

Comment From: jdubois

Unfortunately there isn't one... And yes I believe the combination of all 3 variables makes it pretty unique.

Comment From: scottfrederick

Closing in favor of #27819.