更新时间:2023-01-08 23:10:44
在服务器(即POST请求被发送到)需要包括访问控制允许-headers
头(ETC)的在其回应。将它们放在你的请求来自客户端没有任何效果。
The server (that the POST request is sent to) needs to include the Access-Control-Allow-Headers
header (etc) in its response. Putting them in your request from the client has no effect.
这是因为它是由服务器来指定它接受跨域请求(以及它允许内容类型
请求头,等等) - 客户端无法自行决定给定服务器应该允许CORS
This is because it is up to the server to specify that it accepts cross-origin requests (and that it permits the Content-Type
request header, and so on) – the client cannot decide for itself that a given server should allow CORS.