How it is possible to add Access-Control-Allow-Origin: *
header to all responses (in particular, I am interested for static files under /public/
) in Meteor? I would need this so that external web apps can access data provides by my Meteor app. More information about enabling CORS is here.
相关问题
- firebase storage cors strange Behaviour
- A good way to define default rendering templates i
- How do I add CORS to a compojure-api app?
- CORS issue with Twitter api calls in Webpack dev s
- How to integrate meteor's velocity tests with
相关文章
- Security concerns about CORS
- Configure Spring for CORS
- External dependencies (like bootstrap) in Meteor
- subdomain CORS in webApi 2
- CORS request did not succeed on Firefox but works
- how to properly configure meteor to work with node
- Run Angular and ASP.NET Web API on the same port
- Can meteor mongo driver handle $each and $position
There are two ways to go about this. One is to modify the meteor code and add it in (so that every file will be have this header). This might not be a great idea because you dont want every single file to have this. But if you do alter up do it with hooking into app
The other is to use a custom route with something like meteor router. This way you can control what files you want to have the headers in so its probably best to use something like this
Server side js:
Here is a little snippet I wrote. You can use as an example in how to access meteor's core connect and modify headers, also a pretty good drop-in for every meteor project: