【问题标题】:How do I fix AWS S3 Cors issue?如何解决 AWS S3 Cors 问题?
【发布时间】:2021-02-17 10:46:45
【问题描述】:

对 XMLHttpRequest 的访问已被 CORS 策略阻止:对预检请求的响应未通过 访问控制检查:请求的资源上不存在“Access-Control-Allow-Origin”标头。

我的 CORS 配置:

[
{
    "AllowedHeaders": [
        "*"
    ],
    "AllowedMethods": [
        "PUT",
        "POST",
        "GET",
        "DELETE"
    ],
    "AllowedOrigins": [
        "*"
    ],
    "ExposeHeaders": [
        "ETag",
        "x-amz-server-side-encryption",
        "x-amz-request-id",
        "x-amz-id-2",
        "Content-Length",
        "Content-Type",
        "Connection",
        "Date",
        "x-amz-version-id",
        "Server"
    ],
    "MaxAgeSeconds": 10
}
]

请求标头:

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7
Access-Control-Request-Headers: authorization,content-type,x-amz-content-sha256,x-amz-date,x-amz- 
user-agent
Access-Control-Request-Method: POST
Cache-Control: no-cache
Connection: keep-alive
Host: s3.amazonaws.com
Origin: http://localhost:8080
Pragma: no-cache
Referer: http://localhost:8080/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/86.0.4240.111 Safari/537.36

【问题讨论】:

  • 刚刚添加了几个 Access-Control-Request-Headers 在暴露的标头中丢失。没有任何改变

标签: amazon-s3


【解决方案1】:

它试图到达一个错误的区域,因为我没有指定一个

【讨论】:

  • 您能否为可能遇到相同问题的人添加更多详细信息?
猜你喜欢
  • 2017-07-16
  • 2019-12-07
  • 1970-01-01
  • 2021-12-01
  • 1970-01-01
  • 2020-09-23
  • 2019-12-29
  • 2021-11-14
  • 2012-05-24
相关资源
最近更新 更多