azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Default hostname changes (azurewebsites.net)

Open mathewc opened this issue 1 year ago • 1 comments

The App Service platform is moving to a strategy where the default hostname for a site will vary regionally. This means that code can't simply assume "azurewebsites.net".

New default hostname format: siteName-<dnlHash>.<region>.azurewebsites.net​ SCM site will have this format:​ siteName-<dnlHash>.scm.<region>.azurewebsites.net

There are several known places in the host currently where we're using this string literal. We'll need to review all these and make changes as required. These include:

  • In defaulting the hostname used by the Host ID provider for Linux Dedicated (code here)
  • In constructing the Host ID for Linux Consumption (code here)
    • Note: there's already a related issue for this https://github.com/Azure/azure-functions-host/issues/8788.
    • We might just be able to live with the existing code since it still technically works, even with the new hostname format.
    • Any changes to the Host ID format for existing apps would of course be breaking.
  • In the JWT issuer/audience values (code here). These aren't a problem and would be difficult to change anyways, since the App Service platform and Kudu are using these same values and rely on this contract.
  • FunctionsSyncManager uses the hostname to make Front End settriggers calls (code here). We need to make sure that the hostname value returned by the HostNameProvider is correct in all cases for these calls to work. For Linux Dedicated, I see there's already a problem - for that platform WEBSITE_HOSTNAME isn't set (at least it wasn't when the code was written), so it hardcodes "azurewebsites.net". This will need to change.

mathewc avatar May 01 '24 16:05 mathewc

Work for this is in progress. Finalizing validation.

fabiocav avatar Jul 03 '24 20:07 fabiocav

Please find notes from my investigation below.

  • In defaulting the hostname used by the Host ID provider for Linux Dedicated (code here)

HostName provider has hardcoded value for linux dedicated however the code path that hardcodes the value does not activate. This is because WEBSITE_HOSTNAME is available on Linux Dedicated. We simply need to remove the coding as it is dead code anyway. Remove the hardcoded string used to create hostname for Linux dedicated Remove the hardcoded string used to create hostname for Linux dedicated.

The host id generated here for region specific host name works fine. Any change here would be breaking for existing customers in sovereign and air gapped clouds. We can try to make the change here so that it only applies to public cloud.

  • FunctionsSyncManager uses the hostname to make Front End settriggers calls (code here). We need to make sure that the hostname value returned by the HostNameProvider is correct in all cases for these calls to work. For Linux Dedicated, I see there's already a problem - for that platform WEBSITE_HOSTNAME isn't set (at least it wasn't when the code was written), so it hardcodes "azurewebsites.net". This will need to change.

Have validated the hostname for all SKU's. As mentioned above WEBSITE_HOSTNAME is available in Linux dedicated the path that hardcodes the value is not activated.

Additionally have filed the item below Evalute if WEBSITE_DEFAULT_HOSTNAME should be used for setting hostname

soninaren avatar Aug 09 '24 00:08 soninaren