Hi!
I’m using Meteor as a backend and my frontend client is not running on Galaxy.
I’ve been using this setup for a few months without particular issue.
I just had one to fix: CORS. When the client connects to /sockjs/info?cb=
, I used to get: “xxx has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”
A few months back I managed to fix it with adding these lines in the main.ts file:
WebApp.rawConnectHandlers.use((_, res, next) => {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8102');
res.setHeader('Access-Control-Allow-Origin', 'https://myfrontendserver.com');
res.setHeader('Access-Control-Allow-Headers', 'Authorization,Content-Type');
return next();
});
However, it has been failing again for some days (less than a month) but I haven’t been able to clearly identified when. I’m quite sure it’s because of an update (Meteor 2.2?). I’ve just updated to 2.3 and it didn’t solve it. I don’t think I’ve done any change in the code that could have an impact on this.
What bothers me is that locally when I run the server in debug, it never calls this handler. I even added logs and they don’t show up. So basically, it seems that WebApp.rawConnectHandlers.use
doesn’t work anymore.
Is anyone aware of changes around this?
Or any different workaround for CORS issues?
Thanks!