我的目标是公开提供来自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