Apache 服务器跨域问题解决方法

修改配置文件 httpd.conf 

Header set Access-Control-Allow-Origin * //允许所有ip访问,请根据实际需要指定ip
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, authorization" //authorization是自定义的授权字段
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PUT, DELETE, PATCH" //允许所有方法,请根据实际需要做适当删减

Enjoy it !

猜你喜欢

转载自www.cnblogs.com/daizhongxing/p/12909644.html