当前版本的Nginx(1.0.x)似乎不支持HTTP
OPTIONS请求。发送此请求时,它将返回405“方法不允许”。我在nginx服务器的配置文件中添加了标题,以解决我的问题。
location / { alias /usr/share/nginx/webapp/; try_files $uri $uri/ /index.php; if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; add_header 'Access-Control-Allow-Methods' "GET, POST, OPTIONS, DELETE"; add_header 'Access-Control-Max-Age' 1728000; return 200; } }-



