Firebase Hosting MIME类型

编程入门 行业动态 更新时间:2024-10-26 10:27:27
本文介绍了Firebase Hosting MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在使用Firebase托管托管文件时,是否有人找到一种设置Content-Type标头中返回的mime类型的方法?文档说他们在规则文件中支持某些标头,但不支持内容类型,我仍然将其绑定,但由于错误"hosting.headers [0] .headers [0] .key"不是其中之一,因此无法进行"firebase部署"枚举值".另外,我需要提供的文件不能具有扩展名,这会使Firebase很难自动发现文件类型.

Has anyone found a way to set the mime type returned in the Content-Type header when hosting a file using Firebase Hosting? The docs say they support some headers in their rules file but not the content-type and I tied it anyway but fails the 'firebase deploy' due to error 'hosting.headers[0].headers[0].key is not one of enum values'. Also, the file i need to serve cannot have an extension which makes things harder for firebase to auto discover the type of the file.

推荐答案

我对此进行了测试,它似乎可以工作.另外,对于第二个问题,为什么不设置扩展名,而是将其更改为所需的mimetype?

I tested this and it seems to work. Also for your second issue why not set an extension anyways but change it to the mimetype you need?

{ "database": { "rules": "database.rules.json" }, "hosting": { "public": "public", "rewrites": [ { "source": "**", "destination": "/index.html" } ], "headers": [ { "source": "**/*.@(datagz|memgz|mem|data)", "headers": [ { "key": "Content-Type", "value": "application/octet-stream" } ] } ] } }

更多推荐

Firebase Hosting MIME类型

本文发布于:2023-11-15 08:00:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1592599.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   Firebase   Hosting   MIME

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!