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