cookie跨域设置Access-Control-Allow-Origin无效

后端设置了header('Access-Control-Allow-Origin: http://10.0.23.16:8088')
返回依然是Access-Control-Allow-Origin: *

碰到cookie跨域问题,设置如下

header('Access-Control-Allow-Headers: Origin. X-Requested-With, Content-Type, Accept, withCredentials');
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Origin: http://10.0.23.16:8088');
//http://10.0.23.16:8088是前端网址

前端用的axios

axios.defaults.withCredentials = true;

但是这样并没有成功,浏览器报错

clipboard.png

求各位帮助

这里是响应和请求头

clipboard.png

阅读 7k
1 个回答

晕,apache服务器没有开启cors,但是设置了居然自带了一项设置

<Directory />
    Require all denied
    Header set Access-Control-Allow-Origin *
</Directory>

改掉就好了

推荐问题