At http://mcavage.me/node-restify/#Bundled-Plugins, CORS it stands:
server.use(restify.CORS())
I guess it should be server.pre(restify.CORS()); at least only with pre it work for me.
Also you should mention about restify.fullResponse() there.
Just spent one hour trying to handle CORS.
+1 this solved my problem, thank you :)
The solutions I found while googling returned the old issue, #284, which doesn't include this solution (using .pre).
+1 this solved my problem, thank you :) (cp)
Thanks :)
+1
+1 ...thanks!
thanks°° +1
Got me scratching for an entire afternoon for this one. I guess there might be something wrong with restify.CORS() and restify.fullResponse because preflight errors are intermittent. Now I'm using node-cors module as replacement to restify.CORS() and it worked without the errors now.
var cors = require('cors');
server.use(cors());
server.use(restify.fullResponse());
Can you send a case to reproduce?
On Tuesday, April 21, 2015, James Santos [email protected] wrote:
Got me scratching for an entire afternoon for this one. I guess there
might be something wrong with restify.CORS() and restify.fullResponse
because preflight errors are intermittent. Now I'm using node-cors module
as replacement to restify.CORS() and it worked without the errors now.var cors = require('cors');
server.use(cors());
server.use(restify.fullResponse());—
Reply to this email directly or view it on GitHub
https://github.com/mcavage/node-restify/issues/573#issuecomment-94741598
.
Via mobile
Thanks everyone for patiently waiting for an update on CORS. The module now lives at https://github.com/TabDigital/restify-cors-middleware/
It also has been completely revamped to properly handle CORS requests :tada:! There is a new documentation website coming in the near future, and the current docs are being deprecated. Closing this issues as resolved for now :heart: if I'm missing a nuance and these issues are not resolved, comment and we can re-open to discuss!
Most helpful comment
Got me scratching for an entire afternoon for this one. I guess there might be something wrong with
restify.CORS()andrestify.fullResponsebecause preflight errors are intermittent. Now I'm using node-cors module as replacement torestify.CORS()and it worked without the errors now.