add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Method GET,POST;

在跳转的目标ng上配置添加两个header。

 

通过valid_referers限制防盗链;

valid_referers none block www.baidu.com;
if ($invalid_referer){
  return 403;
}

 

造就自己