点大商城前端跨域问题处理

nginx配置文件:

     location / {
          if ($request_method = 'OPTIONS') {
              add_header Access-Control-Allow-Origin *;
              add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,OPTIONS';
              add_header Access-Control-Allow-Headers '*';
              add_header Access-Control-Max-Age 1728000;
              return 200;
            }
        
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,OPTIONS';
            add_header Access-Control-Allow-Headers '*';
        
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?s=/$1 last;
                break;
            }
        }