VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.88k forks source link

Pass request headers through context #2039

Closed Apollinaire closed 6 years ago

Apollinaire commented 6 years ago

I think it could be a good idea to pass the request headers along in the context, to allow logging internally. This can be done by adding a single line here: https://github.com/VulcanJS/Vulcan/blob/485f7bad379ba3021278e3cf8de0f2ad23bf6be4/packages/vulcan-lib/lib/server/apollo_server.js#L184 options.context.headers = req.headers;

It could be useful to add it in the mutators too as said here : https://github.com/VulcanJS/Vulcan/blob/485f7bad379ba3021278e3cf8de0f2ad23bf6be4/packages/vulcan-lib/lib/server/mutators.js#L104

My only problem is wether we should pass the Authorization header, that might be a possible security issue?

SachaG commented 6 years ago

Why not. If you're just passing this to the server I don't think it can be a security issue?