作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试从 S3 存储桶加载 .svg 图标时,我的控制台中出现此错误:
Failed to load https://<my_bucket>.s3.amazonaws.com/static/js/Trumbowyg-master/dist/ui/icons.svg:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://<my_site>.com' is therefore not allowed access.
知道如何解决这个问题吗?
最佳答案
配置您的 CORS 规则,这里有一个带有通配符 (*) 来源的示例 - 您可以使用自己的来源和所需的方法,然后保存更改。
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
关于javascript - 无法加载 <资源> : No 'Access-Control-Allow-Origin' header is present on the requested resource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48962261/
我是一名优秀的程序员,十分优秀!