Reputation: 21249
I have a couple of firebase hosted sites pointing to the same directory.
For this particular instance I would like a specific site to use a different default index than the public folder's index.html file.
I've set the sub-site firebase hosting deployment to something similar to this:
{
"target": "subsite",
"public": "hosting/public_mysite",
"headers": [
{
"source": "/",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
}
],
"ignore": [
"firebase.json",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/about",
"destination": "/subsite/about.html"
},
{
"source": "/reviews",
"destination": "/subsite/reviews.html"
},
{
"source": "**",
"destination": "/subsite/home.html"
}
]
}
On the sub-site, the urls /about and /reviews do indeed load the requested alternative pages listed in rewrites section.
The last rule "source": "**"
seems to be completely ignored and firebase loads the /index.html anyway.
Why is it not loading /subsite/home.html
instead?
The file is definitely there with the other ones.
Upvotes: 1
Views: 596
Reputation: 47923
See Priority order of Hosting responses.
/__/*
path segmentVisiting /
will prioritize the root index.html
before matching against any rewrites
. If you want to render a different resource you'll have to deploy without the root index.html.
Upvotes: 2