Nginx 跨域配置支持

  1. #允许跨域请求的域,*代表所有
  2. add_header 'Access-Control-Allow-Origin' *;
  3. #允许带上cookie请求
  4. add_header 'Access-Control-Allow-Credentials' 'true';
  5. #允许请求的方法,比如 GET/POST/PUT/DELETE
  6. add_header 'Access-Control-Allow-Methods' *;
  7. #允许请求的header
  8. add_header 'Access-Control-Allow-Headers' *;

Nginx 防盗链配置支持

  1. #对源站点验证
  2. valid_referers *.gowithtommy.com;
  3. #非法引入会进入下方判断
  4. if ($invalid_referer) {
  5. return 404;
  6. }