使用nginx搭建PbootCMS跨域解决方法
使用nginx搭建PbootCMS项目中,因部分条件因素可能需要跨域,但会报错。解决办法在Nginx location里加上如下代码可以解决跨域问题:
在Nginx配置文件nginx.conf加入如下代码:
location/{#跨域设置 add_header Access-Control-Allow-Origin*; add_header Access-Control-Allow-Methods'GET,POST,OPTIONS'; add_header'Access-Control-Allow-Credentials''true'; if($request_method='OPTIONS'){return 200;} }
声明:本站所有资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。