monsur / enable-cors.org

Advocacy for CORS
http://enable-cors.org/
208 stars 98 forks source link

Instructions for Meteor.js don't set CORS for CSS and JS files #112

Closed andrewtamura closed 8 years ago

andrewtamura commented 8 years ago

The current instructions say this

WebApp.connectHandlers.use(function(req, res, next) {
  res.setHeader("Access-Control-Allow-Origin", '*');
  return next();
});

However, this line does not set the headers for Meteor's CSS and JS files. The code should be updated to

WebApp.rawConnectHandlers.use(function(req, res, next) {
  res.setHeader("Access-Control-Allow-Origin", '*');
  return next();
});

Notice WebApp.rawConnectHandlers vs WebApp.connectHandlers. This has been testing on Meteor v1.2.1

andrewtamura commented 8 years ago

Fixed in https://github.com/monsur/enable-cors.org/pull/113