Firebase主机-通配符重定向
我想使用Firebase托管托管一个angular应用程序,我需要在另一个URL中创建到一些旧文件的重定向 根据Firebase文档,您可以执行基本重定向Firebase主机-通配符重定向,firebase,firebase-hosting,Firebase,Firebase Hosting,我想使用Firebase托管托管一个angular应用程序,我需要在另一个URL中创建到一些旧文件的重定向 根据Firebase文档,您可以执行基本重定向 "redirects": [ { "source" : "/foo", "destination" : "/bar", "type" : 301 }, { "source" : "/firebase/*", "destination" : "https://www.firebase.com",
"redirects": [ {
"source" : "/foo",
"destination" : "/bar",
"type" : 301
}, {
"source" : "/firebase/*",
"destination" : "https://www.firebase.com",
"type" : 302
} ]
但我需要一个通配符重定向
"redirects": [ {
"source" : "/config/*",
"destination" : "//oldsiteurl/config/[match-request]",
"type" : 302
}]
因此,基本上我需要myapp.firebase.com/config/some.json
重定向到//oldsiteurl/config/some.json
。我有很多json文件,所以我不想逐个文件进行匹配
你知道这是否可能吗
谢谢 来自(重点矿山):
如果找到匹配项,则会设置HTTP重定向响应,并将“Location”头设置为static目标字符串,该字符串可以是相对路径或绝对URL
因此,看起来匹配的通配符部分没有转入重定向。对于登录此页面的用户,现在可以在URL中使用通配符: 有时需要捕获重定向的源URL的一部分,并在目标中重新使用它们。您可以使用
:
前缀来标识段,并在名称后使用可选的*
来指示它应该捕获URL的其余部分
()
"redirects": [
{
"source": "/subdomain/:random*",
"destination": "https://subdomain.myapp.com/:random*",
"type": 301
}
]