- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的应用程序将图像存储在S3上,然后通过Cloudfront代理它们。我很高兴能够使用新的 S3 CORS 支持,以便我可以使用 HTML5 Canvas 方法(具有跨源策略),但似乎无法配置我的S3 和 Cloudfront 正确。当我尝试将图像转换为 Canvas 元素时,仍然遇到“未捕获错误:SECURITY_ERR:DOM 异常 18”
。
这是我到目前为止所拥有的:
S3
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>MY_WEBSITE_URL</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
<CORSRule>
<AllowedOrigin>MY_CLOUDFRONT_URL</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
云前端
起源
Origin Protocol Policy: Match Viewer
HTTP Port: 80
HTTPS Port: 443
行为
Origin: MY_WEBSITE_URL
Object Caching: Use Origin Cache Headers
Forward Cookies: None
Forward Query Strings: Yes
我在这里缺少什么吗?
更新:只是尝试将标题更改为
<AllowedHeader>Content-*</AllowedHeader>
<AllowedHeader>Host</AllowedHeader>
基于这个问题Amazon S3 CORS (Cross-Origin Resource Sharing) and Firefox cross-domain font loading
还是不行。
更新:根据要求提供更多信息
Request
URL:https://d1r5nr1emc2xy5.cloudfront.net/uploaded/BAhbBlsHOgZmSSImMjAxMi8wOS8xMC8xOC81NC80Mi85NC9ncmFzczMuanBnBjoGRVQ/32c0cee8
Request Method:GET
Status Code:200 OK (from cache)
更新
我想也许我的请求不正确,所以我尝试启用 CORS
img.crossOrigin = '';
但是图像无法加载,并且出现错误:跨源资源共享策略拒绝跨源图像加载。
最佳答案
2014年6月26日AWS发布proper Vary: Origin behavior on CloudFront所以现在你只需
为您的 S3 存储桶设置 CORS 配置,包括
<AllowedOrigin>*</AllowedOrigin>
在 CloudFront 中 -> 分布 -> 此源的行为
Origin
列入白名单 header 。等待大约 20 分钟,CloudFront 会传播新规则
现在,您的 CloudFront 分配应该为不同的客户端 Origin header 缓存不同的响应(具有正确的 CORS header )。
关于amazon-s3 - S3 + Cloudfront CORS 配置正确吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12358173/
我已经为我们的 Cloudfront 分配设置了一个备用域名,这样我们就可以从 oursite.com 提供服务。我们想禁用 ourdistid.cloudfront.net,这样我们的站点只能从一个
假设一个域名为 www.example.com 的网站托管在网站托管商(而非亚马逊)的 LAMP 服务器上。该域由 Route53 管理。 是否有可能以某种方式保留 LAMP 网络服务器上的所有设置并
我在使Cloudfront具有多个来源的工作时遇到麻烦。 我有两个起源: 起源1 小路: 默认 (*) 起源: Custom-example1.com/p 起源2 小路: ns/ 起源: Custom
TLDR:我们必须通过为来自 Lambda 函数的响应创建新的缓存行为来欺骗 CloudFront 307 重定向缓存。 你不会相信我们离实现这一目标有多近。我们在最后一步卡得太厉害了。 商业案例:
How do you set a default root object for subdirectories for a statically hosted website on Cloudfron
有人知道如何使使用友好 url 的自定义来源的根文档无效吗? 例如:example.com ? 通过 AWS Create Invalidation 对话框请求的正确对象路径是什么? 文档仅引用实际文
我正在使用带有自定义源的 CloudFront,并希望将来自 Web 应用程序的某些请求重定向到 CloudFront(客户端使用直接 URL,不能更改为基于 CloudFront 的 URL)。为了
我正在尝试在 AWS CloudFront 上上传公钥。我按如下方式生成 key ssh-keygen -t ecdsa -b 521 我也试过 ssh-keygen -b 4096 当我通过控制台上
我在 wordpress 重定向中的重定向导致域更改时遇到了一些问题。 例子:网站 - noncdn.somedomain.comCDN 网址 - www.domain.com 当我打开没有尾部斜杠的
在 CloudFront 行为设置中,“全部”是将所有请求 header 转发到源吗? Values That You Specify When You Create or Update a Dist
我们的应用程序中使用的图像是从 Amazon CloudFront 呈现的。 修改现有图像时,它不会立即反射(reflect)图像更改,因为 CloudFront 需要大约 24 小时才能更新。 作为
我想设置亚马逊云端,但是 Assets 需要在 http 和 https 上都可用。 我也想使用多个 cname。例如xyz0.cloudfront.netxyz1.cloudfront.netxyz
路径模式属性的文档并不完全详尽。 The pattern to which this cache behavior applies. For example, you can specify imag
我浏览了文档并进行了大量搜索。这些是我知道我可以使用 CloudFront 创建的签名 url 做的事情: 使用固定策略设置时间限制 监控该项目被查看的次数 我还可以为我的签名 URL 设置命中限制吗
cloudfront 是否支持 TLSv1.3 我没有看到任何文档说它在 cloudfront 和自定义来源之间支持?我强烈要求使用 TLSv1.3 最佳答案 CloudFront 现在支持 TLS
我最近才在阅读 Varnish Cache 的功能,以帮助优化我的 PHP 网站的性能。我读到了一个名为 Edge Side Includes 的功能,它似乎让我可以选择构建可以缓存在组件级别的 ht
我是部署静态站点的新手。搜索了大约一段时间的解决方案,根据我遇到的问题,我没有找到任何有用的信息。 宗旨 :我想在 CloudFront 上运行我生成的 Nuxt.js 静态站点。 问题 : 跑命令n
我正在使用 Amazon CloudFront 传送一些 HDS 文件。我有一个原始服务器,它检查 HTTP HEADER REFERER,如果不允许,它会阻止它。 问题是云前端正在删除引用 head
我正在使用 lambda@edge 通过 cloudfront 重定向我的网站。 我已将版本化 lambda arn 附加到我的云前端缓存行为及其所有 4 个事件。 当我访问我的云端端点时,它会显示
有没有办法让 Amazon CloudFront 失效(通过管理控制台),使所有匹配模式的文件失效?例如图像/*.png 语境 - 我在我的网站上为图像设置了缓存控制,但错误地在 Apache 的缓存
我是一名优秀的程序员,十分优秀!