azureazure-functionsazure-function-app-proxy

Map entire subdomain to Azure Function


Is there a way to map an entire subdomain to an Azure Function and pass in the folder structure without proxying it through a VM or App Service? For instance, https://example.com/path/to/name would pass into an Azure Function something like "path/to/name"?


Solution

  • I was able to resolve this with the help of https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies.

    After creating a new Function App with an Azure Function using JavaScript with an HTTP Trigger, create a Functions Proxy with a route template of {*path} and a Backend URL of https://localhost/api/<trigger name>?code=<trigger code>&path={path}. On a GET, the path is available at req.query.path, and the original url is available at req.originalUrl.