Flight request returning 406 error code on PUT / DELETE

I'm currently writing a client in jQuery and using AJAX which consumes an API that I've coded myself in PHP. Recently, I've encountered a problem with PUT and DELETE requests.

The pre-flights requests sent by the browser are returning a 406 (not acceptable) error code.

After reading a lot of similar questions, this is what I've included in the server, but I still got the same errors.

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,Accept,X-Requested-With,Session');

Here is the error returned by chrome

XMLHttpRequest cannot load https://api.com/api/1.0/users. Response for preflight has invalid HTTP status code 406

This is my API response's headers:

在这里输入图像描述

链接地址: http://www.djcxy.com/p/41122.html

上一篇: CSS / JavaScript / hacking:检测:在链接上访问的样式*不需要*直接检查或者比我快

下一篇: 航班请求在PUT / DELETE上返回406错误代码