We are using PassportJS with a couple of Node.js servers - Passport is just a library that is popular for Node.js server authentication - but we have some questions about how to use Passport with "proxy" requests. My main question is how do we (and should we at all) forward the headers and cookies in the original request to the proxied request?
For example - we make a browser-client request to server A which in turn makes a request to server B - we want the same client to be authenticated in the same way on both servers. Currently if the web client makes a request directly to both servers, the client is authenticated, but if the client authenticates with A and then A sends a completely new request to server B, then of course, that second request contains none of the auth info that is needed to authenticate the client on server B.
Considering we own both servers A and B, should we just include the headers and cookies from the original request in our request from server A to B?
is this considered a good practice? Any info would be helpful, thanks
I asked a similar question of Jared Hannson of PassportJS fame:
https://github.com/jaredhanson/passport-github/issues/52
Given a good answer here, I might copy it over there