Apache跨域问题
城南花开 / 2020-02-05 / 编程技术 / 阅读量 40

Access-Control-Allow-Origin’ header is present on the requested resource

httpd.conf 取消如下注释

LoadModule headers_module [...]

然后VirtualHost服务中添加

Header set Access-Control-Allow-Origin "*"

全局配置如下

httpd.conf 最下面添加如下配置:

<IfModule mod_headers.c>

Header set Access-Control-Allow-Origin: "*"

Header set Access-Control-Allow-Methods: "GET,POST,PUT,DELETE,OPTIONS"

Header set Access-Control-Allow-Headers: "Content-Type"

</IfModule>