摘要:1.修改apache/conf 目录下的httpd.conf文件:
找到LoadModule headers_module modules/mod_headers.so这一行,去掉前面的#号,如果没有这行,就在配置文件中增加上!
2.修改虚拟主机文件:apache/conf/extra/httpd-vhosts.conf文件:增加两行跨域配置,蓝色字体部分,如下
1.修改apache/conf 目录下的httpd.conf文件:
找到LoadModule headers_module modules/mod_headers.so这一行,去掉前面的#号,如果没有这行,就在配置文件中增加上!
2.修改虚拟主机文件:apache/conf/extra/httpd-vhosts.conf文件:增加两行跨域配置,蓝色字体部分,如下
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, token"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, token"
</VirtualHost>
3.关闭文件,重启tomcat,
./bin/apachectl stop
./bin/apachectl start
测试验证!
相关文章推荐
虚拟主机的专业参数,分别都是什么意思?2022-09-09
中非域名注册规则是怎样的?注册域名有什么用处? 2022-01-10
HostEase新年活动促销 美国/香港主机全场低至五折2021-12-28
HostGator下载完整备份教程分享2021-12-28
Flink中有界数据与无界数据的示例分析2021-12-28