宝塔跨域

首先关于跨域是什么https://baike.baidu.com/item/...
在宝塔Linux面板算对新手比较友好的服务器面板,但是也是不可以避免一些服务器常见的问题例如跨域问题:
网站》选择网站》配置文件
解决方法

 
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';


来到这个页面在最下面粘贴上面的代码,后重启服务器就可以了

转载自 https://segmentfault.com/a/1190000037480546?utm_source=tag-newest

原文地址:https://www.cnblogs.com/fpcing/p/14604850.html