首页 > 其他分享 >跨域访问

跨域访问

时间:2022-10-04 10:56:48浏览次数:52  
标签:Control 跨域 header Access 访问 add Allow OPTIONS

搞代码搞不通,直接在IIS 、Nginx 添加

IIS  HTTP响应标头  添加

Access-Control-Allow-Headers    值    *
Access-Control-Allow-Methods    值    OPTIONS,POST,GET
Access-Control-Allow-Origin      值    *


Nginx

location / {  
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers '*';
}

 

代码里去掉header里这三项,避免重复错误

标签:Control,跨域,header,Access,访问,add,Allow,OPTIONS
From: https://www.cnblogs.com/yingshiyu/p/16753391.html

相关文章