从 Google Storage 公共网址中删除"X-Content-Type-Options: nosniff"标头



我的目标是公开提供来自Google Storage的静态text/javascript文件,以作为脚本标签包含在内。

我遇到了这个浏览器错误:

"X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

我卷曲了Google存储URL,发现它的302将我重定向到另一个包含实际Content-Type: text/javascript文件的链接,X-Content-Type: nosniff有问题的标头。

有没有办法防止公开可用的文件出现这种重定向?

更改网址解决了阻止 Google Storage 302 重定向的问题。

从:

https://storage.cloud.google.com/<bucket-name>/script.js

自:

https://storage.googleapis.com/<bucket-name>/script.js

最新更新