Request header field * is not allowed by Access-Control-Allow-Headers in preflight response

跨域问题记录:请求 headers里添加自定义header时,出现以下错误

Request header field * is not allowed by Access-Control-Allow-Headers in preflight response_第1张图片


错误原因   

Request header field * is not allowed by Access-Control-Allow-Headers in preflight response_第2张图片

参考:https://www.cnblogs.com/cc299/p/7339583.html

解决方法如下

nginx  配置 add_header 'Access-Control-Allow-Headers' 添加 自定义header 

add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,access_token';

你可能感兴趣的:(nginx,Web前端)