且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Access-Control-Allow-Headers 不允许请求标头字段 Access-Control-Allow-Headers

更新时间:2022-03-23 22:29:16

服务器(POST请求发送到的)需要包含Access-Control-Allow-Headers 标头(等​​)在其响应中.将它们放入来自客户端的请求中没有任何效果.

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.

这是因为由服务器指定它接受跨域请求(并且它允许 Content-Type 请求标头,等等)——客户端无法决定给定服务器本身应该允许 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.