I'm using restify for my application. The cross origin requests works fine for GET with restify's CORS but shows following error for POST request.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:1337/path/add. This can be fixed by moving the resource to the same domain or enabling CORS.
The code for enabling CORS i've used is:
server.use(restify.CORS());
as per its documentation. Can anyone suggest me how to make the POST request work
I have run into the same problem this morning, the change that worked for me was to change:
server.use(restify.CORS());
To:
server.pre(restify.CORS());
server.use(restify.fullResponse());
the server.pre being the important bit. I found a bug relating to an error in the documentation: