Open dylanmensaert opened 7 years ago
I try to enable CORS via middleware option by adding extra headers to the response. My code for this is:
middleware: function (connect, options, middlewares) { middlewares.unshift(function(req, res, next) { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Methods', '*'); return next(); }); return middlewares; }
This works correctly, but an extra header is being added also which makes the response invalid. The header being added is Allow: GET, HEAD, OPTIONS.
Allow: GET, HEAD, OPTIONS
I tried to add code to the unshift method to remove this header, namely res.removeHeader('Allow');, but it does not seem to work.
res.removeHeader('Allow');
Any suggestions?
I try to enable CORS via middleware option by adding extra headers to the response. My code for this is:
This works correctly, but an extra header is being added also which makes the response invalid. The header being added is
Allow: GET, HEAD, OPTIONS
.I tried to add code to the unshift method to remove this header, namely
res.removeHeader('Allow');
, but it does not seem to work.Any suggestions?