我前端是用react + redux
后端用node,用superagent来拉取后端数据
拉取本地数据的时候出现跨域问题
XMLHttpRequest cannot load http://localhost:3000/init/redis. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3020' is therefore not allowed access.
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
https://developer.mozilla.org/zh-CN/docs...
在浏览器访客模式下(干净模式),web inseptor WEB调试工具抓一下,是否有OPTIONS协议,如果有——
尝试实现一个OPTIONS协议响应(或者中间件)来处理Access-Control-Allow-Origin,告知浏览器允许跨域
用nginx反向代理后端