1. ios12 系统跨域请求,状态码0

ios 12.3.1 请求接口跨域问题

 

 

2. 原因:跨域请求options中请求头缺少参数
请求头信息 Access-Control-Request-Headers: accept, content-type, origin

3. nginx反向代理的解决方法:判断是optinos,添加参数Origin,Accept

if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Headers 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,Origin,Accept,X-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,tenant';
add_header Access-Control-Allow-Credentials 'true';
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
return 204;
}

 

相关文章:

  • 2021-05-02
  • 2021-09-21
  • 2021-10-07
  • 2021-11-04
  • 2021-05-30
  • 2022-12-23
  • 2021-07-01
猜你喜欢
  • 2021-04-17
  • 2021-04-19
  • 2021-04-23
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案