Firebase托管:如何根据源域重定向URL

时间:2018-03-22 06:13:02

标签: firebase single-page-application google-cloud-functions firebase-hosting

我的规则如下,但我希望这只适用于原点是除当前域以外的任何其他域。

如果我的域名是friends.com,则所有内容都应该转到索引,否则请按以下方式处理。例如,如果来自Google,使用类似friends.com/user的路径,则应调用firebase https function而不是转发索引。

{
    "hosting": {
        "public": "y",
        "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
        "rewrites": [{
                "source": "/user",
                "function": "user"
            },
            {
                "source": "/post",
                "function": "post"
            },
            {
                "source": "/*",
                "destination": "/index.html"
            }
        ],
        "headers": [{
            "source": "/css/**",
            "headers": [{
                "key": "Cache-Control",
                "value": "max-age=0"
            }]
        }]
    }
}

0 个答案:

没有答案