upstream video_server_pool{
server 127.0.0.1:3359 weight=10;
}
#允许跨域访问的列表
map $http_origin $origin_list{
default http://www.boqian.com;
"~http://www.xuecheng.com" http://www.boqian.com;
}
#虚拟服务器
server {
listen 80;
server_name video.boqian.com;
location /video {
proxy_pass http://video_server_pool;
add_header 'Access-Control-Allow-Origin' $origin_list;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
}
}