自学内容网 自学内容网

【Nginx】前端请求跨域问题

问题描述

Access to fetch at ‘xxx’ from origin ‘xxx’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

解决方案

找到Nginx配置中具体请求的server配置,找到配置: add_header Access-Control-Allow-Origin *;
注释该配置,重启Nginx后重试


原文地址:https://blog.csdn.net/weixin_47610533/article/details/139277022

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!