Requests to my API were going swimmingly until I had to POST data. API is expecting JSON so I changed my content-type
to application/json
, and this causes all CORS implementations to require preflights, and now I'm getting 405. Thing is, request/response looks good. Request headers accept, content-type are in the Access-Control-Request-Headers
. Request method POST
, POST
and PUT
allowed. Access-Control-Allow-Origin allowing all origins. What gives?
Remote Address: -
Request URL: -
Request Method: OPTIONS
Status Code: 405 Method Not Allowed
Request Headers
Accept: */*
*/// for the sake of syntax highlighting
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Access-Control-Request-Headers: accept, content-type
Access-Control-Request-Method: POST
Cache-Control: no-cache
Connection: keep-alive
Host: -
Origin: http://localhost
Pragma: no-cache
Referer: http://localhost/
Response Headers
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Origin: *
Allow: POST,PUT
Cache-Control: no-cache
Content-Length: 76
Content-Type: application/json; charset=utf-8
Date: Wed, 01 Oct 2014 19:43:56 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET