apache跨域配置

阅读量:

36


用Apache比较少,今天正好碰到,记录一下,本质就是修改响应头信息。

1. 取消注释主配置文件中的下面这行

# 加载模块
# LoadModule headers_module modules/mod_headers.so

2. 修改vhost配置

<Directory /www/web/yuming.com/public_html/>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    Header set Access-Control-Allow-Origin *
    # 或者指定具体的主机名
    # Header set Access-Control-Allow-Origin http://example.com
    # Header set Access-Control-Allow-Origin http://localhost:8080
</Directory>

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注