Chrome Cross-Domain PATCH request not working
you should allow OPTIONS in your response header..
"Access-Control-Allow-Methods ", "GET, POST,HEAD, OPTIONS,PUT, DELETE"
I face a similar problem in node.js
with CORS
You need to set the Access-Control-Allow-Origin
to the specific domain not a wildcard.
Example: Access-Control-Allow-Origin
to http://website.com
(You can have on your server an array of origins allowed and check against the request if it is allowed then answer with that one instead of wildcards.)
Also, you can set the Access-Control-Allow-Methods
headers to a list of options like:
POST, GET, OPTIONS, DELETE, PUT
I tried the CORS on Chrome 27.0.1453.116 and it worked for me.From the client side all i did is in jquery AJAX set the 'crossDomain' to true.
$.ajax('http://localhost/Elements.Services/Elements.svc/REST/Element/Get?ID=1', { type: 'GET', crossDomain: true, success: function (data) { alert(data); } });
While on REST service side for each request set the following response headers:
("Access-Control-Allow-Headers", "Accept") or ("Access-Control-Allow-Headers", HTTPRequest.RequestedHeaders + "Accept")
("Access-Control-Allow-Methods", "POST,PUT,GET")
- ("Access-Control-Allow-Origin", "*")
Here is Great article on CORS working, which really helped me.