У меня есть общедоступная папка, например:
/public
index.html
/landing
index.html
/membership
index.html
/public/index.html - это SPA, поэтому каждый запрос к / ** должен быть переписан в /index.html
/ Landing / и / members / - это два статических HTML-лендинга, поэтому каждый запрос не следует переписывать.
firebase.json, предложенный службой поддержки Google:
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "public",
"redirects": [{
"source": "/landing",
"destination": "index.html"
},
{
"source": "/membership",
"destination": "index.html"
}
],
"rewrites": [{
"source": "/membership/**",
"destination": "/membership/index.html"
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
Все просто перенаправляется в /index.html ...
Даже пробовал:
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "public",
"redirects": [{
"source": "/landing/**",
"destination": "/landing/index.html"
},
{
"source": "/membership/**",
"destination": "/membership/index.html"
}
],
"rewrites": [{
"source": "**",
"destination": "/index.html"
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
Тот же результат, все просто попадает в /

Вам не нужно использовать «редиректы». Просто используйте эти правила перезаписи:
{
"functions": {
"source": "functions"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "!/@(landing|membership)/**",
"destination": "/index.html"
},
{
"source": "/landing/**",
"destination": "/landing/index.html"
},
{
"source": "/membership/**",
"destination": "/membership/index.html"
}
]
}
}
Первое правило перепишет все, кроме того, что начинается с приземления ИЛИ членства. Второе правило касается посадочных дорожек. И третий будет указывать, что делать со всеми путями членства.
@dave, я не уверен, но если это была проблема «перенаправления», у вас не должно быть 404, вы должны загрузить index.html. Все ли в порядке, если вы просто используете правило «Основной источник: **»?
Ок, а как можно не переписать / public / static? Я получаю 404 для статических ресурсов из index.html SPA.