我使用火力地堡有firebase.json
文件应该所有流量转发到云功能(预渲染),它填充元和OG标签SEO主机。重定向火力地堡托管根到云功能无法正常工作
{
"hosting": {
"public": "dist/prod",
"rewrites": [
{
"source": "**",
"function": "prerender"
}
]
}
}
我的prerender
函数正在处理请求并呈现HTML文件。这工作得很好:
export const prerender = functions.https.onRequest((req, res) => {
console.log('prerender function: "' + req.path + '"');
...
}
打在https://xxx.cloudfunctions.net/prerender
终点时,我正确地得到中的呼叫火力地堡仪表板功能下 - >日志:
prerender function: "null"
但是,调用https://mypage.firebaseapp.com
的时候,我没有得到任何日志,它似乎在我的dist/prod
文件夹中呈现index.html
。
这有什么,我与重写失踪?我尝试将/
改写为相同的功能,但没有成功。任何提示非常感谢!
谢谢!这工作完美。 –