编辑nginx.conf,实现GET,POST,OPTIONS的跨域请求的支持

http {

  ......
  add_header Access-Control-Allow-Origin *;

  add_header Access-Control-Allow-Headers X-Requested-With;

  add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

  ......

}

注:如想指定允许的url则把add_header Access-Control-Allow-Origin *;换成

add_header Access-Control-Allow-Origin http://www.aaa.com;