根据百度的教程
在宝塔加了下面这个 可还是没用啊
翻了半天百度都没找到解决办法
- add_header Access-Control-Allow-Origin *;
- add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
- add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
复制代码
山东网友:我直接加add_header Access-Control-Allow-Origin *;
没有问题
香港网友:没大佬吗
海南网友:nginx环境. 加入 location / { add_header Access-Control-Allow-Origin *; }
浙江网友:
直接这样添加出错
nginx: [emerg] "location" directive is not allowed here in /www/server/nginx/conf/nginx.conf:20
宝塔的
重庆网友:是在被跨域请求的站加这个,目标站不是你的就别想了。
河北网友:被请求的服务器是你的么???不是自建代理中转下
贵州网友:这个加一
云南网友:当然是请求站啊
云南网友:加到
- http
- {
- include mime.types;
- #include luawaf.conf;
- include proxy.conf;
复制代码这一列吧
未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » 跨域问题~有木有大佬解答下啊