对于 Matrix 家庭服务器(在 Modular.im 上),您需要有 2 个文件:
domain.tld/.well-known/matrix/serverdomain.tld/.well-known/matrix/client...它们还需要application/json代替 firebase 的默认值application/octet-stream。我该如何改变?
当前firebase.json的无效解决方案来自此答案。
$ cat firebase.json
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/.well-known/matrix/server",
"destination": "/.well-known/matrix/server",
"content-type": "application/json",
"code":200
},
{
"source": "/.well-known/matrix/client",
"destination": "/.well-known/matrix/client",
"content-type": "application/json",
"code":200
}
]
}
}
$ firebase deploy
=== Deploying to 'dh'...
i deploying hosting
i hosting[dh]: beginning deploy...
i hosting[dh]: found 19 files in public
? hosting[dh]: file upload complete
i hosting[dh]: finalizing version...
? hosting[dh]: version finalized
i hosting[dh]: releasing new version...
? hosting[dh]: release complete
? Deploy complete!
Project Console: https://console.firebase.google.com/project/dh/overview
Hosting URL: https://dh.firebaseapp.com
$ curl -v https://domain.tld/.well-known/matrix/client 2>&1 | grep content-type
< content-type: application/octet-stream
Run Code Online (Sandbox Code Playgroud)
你遇到的答案是不正确的。您需要指定自定义标题:
{
"hosting": {
"headers": [
{
"source": "/.well-known/matrix/*",
"headers": [
{"key": "Content-Type", "value": "application/json"}
]
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
628 次 |
| 最近记录: |