Search code examples
azureazure-functionsazure-functions-core-tools

Returning static website to Function proxy


Currently I'm working on a Azure Functions v2.x app, where my artifacts (React built files) are defined as backend for my Functions Proxies (as shown below). It's working fine, and apparently this is how it should be done (?) to connect the proxy with blob and to return it once user opens my_route. But I'm wondering where is this (= returning blob with Function proxy) explained on Azure doc? Where can I find a sample by their team? , I'm looking for such a thing to learn more about options. For example, where is querystring.SharedAccessSignature used? It's strange that Googling this doesn't give any result.

Is there any other and de facto way to return static website artifacts to users of our serverless app?

{
    "$schema": "http://json.schemastore.org/proxies",
    "proxies": {
        "myProxy": {
            "matchCondition": {
                "route": "/my_route",
                "methods": [
                    "GET"
                ]
            },
            "backendUri": "https://my_storage.blob.core.windows.net/my_blob/index.html",
            "requestOverrides": {
                "backend.request.querystring.SharedAccessSignature": "my_shared_access_signature"
            }
        }
    }
}

Solution

  • backend.request.querystring.SharedAccessSignature is described in Work with Azure Function Proxies

    The backend.request.querystring object is a way to attach arbitrary query parameters. To accomplish your use case, you're providing the SharedAccessSignature parameter so the backend request ends up looking like https://my_storage.blob.core.windows.net/my_blob/index.html?SharedAccessSignature=my_shared_access_signature

    You can also look at the json schema referenced in Proxies.json to get a better idea of what options are available http://json.schemastore.org/proxies