Firebase Hosting自体のrouting設定
vue使ってたときに画像ファイルや純粋なpdfにルーティングさせる方法がわからなかった為に備忘
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source":"/aaaa.txt",
"destination": "/aaa.txt"
},
{
"source":"/bbbb",
"destination": "/bbb.png"
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
firebase.jsonのrewriteに上書きしてあげればOK
多分デフォルトの”source”: “**”より上に書いてあげないと全部index.htmlに行っちゃう・・・
これでpdfをブラウザでそのまま開きたい時も対応出来ます。
コメントを残す