开心123 发表于 2018-11-13 13:25:38

nginx增加跨域配置header-Tenderrain

  =====================版本1
  add_header 'Access-Control-Allow-Origin' 'data.test.com';
  add_header 'Access-Control-Allow-Methods' 'PUT,POST,GET,DELETE,OPTIONS';
  add_header 'Access-Control-Allow-Headers' 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With';
  add_header 'X-Powered-By' ' 3.2.1';
  并reload
  =====================版本2
  add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Credentials' 'true';
  add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
  add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Connection, User-Agent, Cookie,Content-Type';
  并reload

页: [1]
查看完整版本: nginx增加跨域配置header-Tenderrain