I'm using Firebase Hosting with a firebase.json
file that is supposed to forward all traffic to a cloud function (prerender) which populates meta and og tags for SEO.
{
"hosting": {
"public": "dist/prod",
"rewrites": [
{
"source": "**",
"function": "prerender"
}
]
}
}
My prerender
function is is handling the request and rendering the HTML file. This works fine:
export const prerender = functions.https.onRequest((req, res) => {
console.log('prerender function: "' + req.path + '"');
...
}
When hitting the end point at https://xxx.cloudfunctions.net/prerender
, I correctly get the call in the Firebase Dashboard under Functions -> Logs:
prerender function: "null"
However, when calling https://mypage.firebaseapp.com
, I get no logs and it seems to render the index.html
inside of my dist/prod
folder.
Is there anything I'm missing with the rewrites? I tried rewriting /
to the same function, but no success. Any hints much appreciated!