【问题标题】:This page isn’t working localhost redirected you too many times. ERR_TOO_MANY_REDIRECTS Express js MongoDB此页面无法正常工作 localhost 将您重定向了太多次。 ERR_TOO_MANY_REDIRECTS Express js MongoDB
【发布时间】:2021-03-21 12:04:24
【问题描述】:

我在这里检查会话

app.use((req, res, next) => {
      if (req.cookies.user_sid && !req.session.user) {
        res.clearCookie("user_sid");
      }
      next();
    });
    

我不知道为什么我收到太多重定向错误。

【问题讨论】:

    标签: node.js mongodb express cookies


    【解决方案1】:

    我认为这个工作....

    app.use((req, res, next) => {
        if (!req.session.user) {
             res.clearCookie("user_sid");
        }
        next();
    });
        
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-22
      • 2020-01-03
      • 2023-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多