villadora/express-http-proxy

Proxy session not assigned

Closed this issue · 0 comments

Hello,
I have the following proxy assigned:

app.use('/catalogigraphql', proxy(process.env.GRAPHQL_ENDPOINT || "http://localhost:9100", {
  filter: function(req, res) {
    return isLoggedIn(req);
  }
}));

function isLoggedIn(req) {
  try {
    return !!req.session.passport.user;
  } catch (_err) {
    console.log("NOT LoggedIn");
    return false;
  }
}

When I connect to http://localhost:3000/catalogigraphql The graphql playground is visible but I'm constantly redirected because the req.session.passport.user; is not assigned("NOT LoggedIn" is logged to the console). When I navigate to a route that doe not proxy req.session.passport.user; is assigned.

What is the cause why the session is not assigned?

"express": "^4.17.1",
"express-http-proxy": "^1.6.2",
"express-session": "^1.17.1"
"redis": "^3.0.2", ==> session