如何在 Firebase 中创建带有 503 代码的维护页面?
How to create a maintenance page with a 503 code in Firebase?
使用以下 firebase.json
,我可以将用户重定向到我想要的 maintenance.html
页面。但是,检索到的页面带有 304 状态代码。我希望使用 503 状态代码检索它,以向搜索引擎表明这是临时维护。我试图手动设置 header 但它似乎不起作用。这在 Firebase 中如何实现?
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [ {
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
} ],
"rewrites": [
{
"source": "**"
, "destination": "/index.html"
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}
以下是最终对我有用的东西:
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [
{
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}
使用以下 firebase.json
,我可以将用户重定向到我想要的 maintenance.html
页面。但是,检索到的页面带有 304 状态代码。我希望使用 503 状态代码检索它,以向搜索引擎表明这是临时维护。我试图手动设置 header 但它似乎不起作用。这在 Firebase 中如何实现?
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [ {
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
} ],
"rewrites": [
{
"source": "**"
, "destination": "/index.html"
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}
以下是最终对我有用的东西:
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [
{
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}