Explicit HTTP Response Headers for files in Meteor's public directory

194 views
Skip to first unread message

Charles Holbrow

unread,
Jun 10, 2014, 11:00:17 PM6/10/14
to meteo...@googlegroups.com

I'd like to set custom HTTP Response Headers on files served from the public folder in my Meteor app.

WebApp.connectHandlers.use as described here does not affect headers on the on replies to get requests within the public folder (in Meteor 0.8.1.3)

Are custom headers possible for requests to the public folder?

Looking at the Meteor Source, I can't actually see how the public folder is served, although somehow it gets copied to meteor/build/programs/client/app. along with the rest of the compiled app. Where does the http server actually run from?

The full story is that I'd like to add CORS headers to my static assets - I know there's easier ways to do it, but I'm enjoying learning how the meteor source fits together, so I'd like to be able to solve the problem the hard way first :)

Thanks for any help! Optional Extra credit: Answer my same question on SO for bonus reputation points!

Emily Stark

unread,
Jun 10, 2014, 11:04:43 PM6/10/14
to meteo...@googlegroups.com
Hey Charles,
You should be able to use `WebApp.rawConnectHandlers` to do this; they get run before the Meteor connect handler that serves the static assets. (See packages/webapp/webapp_server.js:259).


--
You received this message because you are subscribed to the Google Groups "meteor-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meteor-talk...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages