允许所有域请求
server { listen 80; server_name inf.netkiller.cn; charset utf-8; access_log /var/log/nginx/inf.netkiller.com.access.log main; error_log /var/log/nginx/inf.netkiller.com.error.log; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers Content-Type,Origin; add_header Access-Control-Allow-Methods GET,OPTIONS; ... ... }
允许特定的域请求
add_header Access-Control-Allow-Origin http://www.netkiller.com;
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。