【apache】Apache配置跨域功能
服务器端对于CORS的支持,是通过设置Access-Control-Allow-Origin来进行的。
如果浏览器检测到相应的设置,就可以允许Ajax进行跨域的访问,也就是相应的‘后门’。
设置Apache:Apache需要使用mod_headers模块来激活HTTP头的设置,它默认是激活的。
在apache安装目录下面找到conf/httpd.conf
禁止跨域
<Directory />
AllowOverride none
Require all denied
</Directory>
允许跨域
<Directory />
Require all denied
Header set Access-Control-Allow-Origin *
</Directory>