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 !

posted @ 2020-05-18 11:42  兴同学在上海  阅读(2819)  评论(0编辑  收藏  举报