gpt4 book ai didi

javascript - AWS Cloudfront 将 javascript 模块作为错误的 MIME 类型 ( "Text/Plain")

转载 作者:行者123 更新时间:2023-12-05 08:29:48 26 4
gpt4 key购买 nike

我在 Amazon S3 存储桶上托管了一个 Vue 应用程序。当通过带有 http 的 S3 链接访问时,它加载得很好。当我通过自定义 SSL 域链接访问该站点时,无法正确提供 javascript。 JS 文件可以通过浏览器中的 https 完全访问,但不要在浏览器中执行,给我留下一个空白页面。对于 index.html 中的两个 javascript 链接,我都收到以下错误:

Failed to load module script: Expected a JavaScript module script butthe server responded with a MIME type of "text/plain". Strict MIMEtype checking is enforced for module scripts per HTML spec.

还有:我按照这里的说明操作:https://levelup.gitconnected.com/deploying-vue-js-to-aws-with-https-and-a-custom-domain-name-3ae1f79fe188

最佳答案

想通了,我只需要在 S3 控制台中为各个 js 对象手动更改系统定义的内容类型,从 text/plain 更改为 application/javascript,然后确保缓存无效并在我的浏览器上刷新。

关于javascript - AWS Cloudfront 将 javascript 模块作为错误的 MIME 类型 ( "Text/Plain"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67925203/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com