Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz'
Simply put, the origin making the request does not match any of the origins permitted by the
Access-Control-Allow-Origin
header.
This error can also occur if the response includes more than one
Access-Control-Allow-Origin
header.
If the service your code is accessing using a CORS request is under your control, make sure that it's configured to include your origin in its
Access-Control-Allow-Origin
header, and that only one such header is included in responses. The header itself accepts a comma-delineated list of origins, so adding a new origin is not difficult.
For example, in Apache, add a line such as the following to the server's configuration (within the appropriate
<Directory>
,
<Location>
,
<Files>
,或
<VirtualHost>
section). The configuration is typically found in a
.conf
file (
httpd.conf
and
apache.conf
are common names for these), or in an
.htaccess
文件。
Header set Access-Control-Allow-Origin 'origin-list'
For Nginx, the command to set up this header is:
add_header 'Access-Control-Allow-Origin' 'origin-list'
Accept
Accept-Charset
Accept-Encoding
Accept-Language
Accept-Ranges
Access-Control-Allow-Credentials
Access-Control-Allow-Headers
Access-Control-Allow-Methods
Access-Control-Allow-Origin
Access-Control-Expose-Headers
Access-Control-Max-Age
Access-Control-Request-Headers
Access-Control-Request-Method
Age
Allow
Alt-Svc
Authorization
Cache-Control
Clear-Site-Data
Connection
Content-Disposition
Content-Encoding
Content-Language
Content-Length
Content-Location
Content-Range
Content-Security-Policy
Content-Security-Policy-Report-Only
Content-Type
Cookie
Cookie2
DNT
Date
ETag
Early-Data
Expect
Expect-CT
Expires
Feature-Policy
Forwarded
From
Host
If-Match
If-Modified-Since
If-None-Match
If-Range
If-Unmodified-Since
索引
Keep-Alive
Large-Allocation
Last-Modified
Location
Origin
Pragma
Proxy-Authenticate
Proxy-Authorization
Public-Key-Pins
Public-Key-Pins-Report-Only
Range
Referer
Referrer-Policy
Retry-After
Sec-WebSocket-Accept
Server
Server-Timing
Set-Cookie
Set-Cookie2
SourceMap
Strict-Transport-Security
TE
Timing-Allow-Origin
Tk
Trailer
Transfer-Encoding
Upgrade-Insecure-Requests
User-Agent
Vary
Via
WWW-Authenticate
警告
X-Content-Type-Options
X-DNS-Prefetch-Control
X-Forwarded-For
X-Forwarded-Host
X-Forwarded-Proto
X-Frame-Options
X-XSS-Protection
100 Continue
101 Switching Protocols
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
300 Multiple Choices
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
307 Temporary Redirect
308 Permanent Redirect
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Payload Too Large
414 URI Too Long
415 Unsupported Media Type
416 Range Not Satisfiable
417 Expectation Failed
418 I'm a teapot
422 Unprocessable Entity
425 Too Early
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
451 Unavailable For Legal Reasons
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
511 Network Authentication Required
CSP: base-uri
CSP: block-all-mixed-content
CSP: child-src
CSP: connect-src
CSP: default-src
CSP: font-src
CSP: form-action
CSP: frame-ancestors
CSP: frame-src
CSP: img-src
CSP: manifest-src
CSP: media-src
CSP: object-src
CSP: plugin-types
CSP: referrer
CSP: report-uri
CSP: require-sri-for
CSP: sandbox
CSP: script-src
CSP: style-src
CSP: upgrade-insecure-requests
CSP: worker-src
report-to