具有多个参数路由模板的Azure函数代理配置

时间:2019-07-03 12:58:52

标签: azure-functions azure-function-app-proxy

我正在尝试为azure节点功能配置代理。我想要实现以下目标:

/ {env}充当根 通过/ {env} / {* filePath}进行的任何后续请求,例如/dev/index.html

其中{env} =开发,测试或生产

访问网址“ http://localhost:7071/dev/”时,一切正常,但是访问网址“ http://localhost:7071/dev”(注意末尾缺少斜杠)时,浏览器会从网址中删除env参数,而我例如,左边有“ http://localhost:7071/index.html”。


    {
        "$schema": "http://json.schemastore.org/proxies",
        "proxies": {
            "root": {
                "debug": true,
                "matchCondition": {
                    "methods": [ "GET" ],
                    "route": "{*env}"
                },
                "backendUri": "%FUNCTION_API%/api/my-function"
            },
            "img": {
                "debug": true,
                "matchCondition": {
                    "methods": [ "GET" ],
                    "route": "/{env}/img/{*filePath}"
                },
                "backendUri": "%FUNCTION_API%/api/my-function"
            },
            "docs": {
                "debug": true,
                "matchCondition": {
                    "methods": [ "GET" ],
                    "route": "/{env}/{*filePath}"
                },
                "backendUri": "%FUNCTION_API%/api/my-function"
            }
        }
    }

我希望能够打http://localhost:7071/dev,而不必键入http://localhost:7071/dev/

0 个答案:

没有答案