When Nodejs is deployed on the same server and running two or more servers at the same time, a service user is logged on to squeeze out another user's problem

Source: Internet
Author: User

Problem Description: A server, the deployment of two or more different Web services, service a users after landing, service B users also logged in, when the user of service a click on the page, will return to the landing page.

The root of the problem: the browser saves the same session, the same cookie

Workaround:

App.use (Expresssession ({    secret: ' Keyboard Cat ',    resave:false,    saveuninitialized:true,    name: ' AAA '//The name here is worth the name of the cookie, the name of the default cookie is: Connect.sid});

Because the default cookie name is ' Connect.sid ', if you do not make a change, the user of the above service A will be squeezed out of User B, set the session name value in App.js.

When Nodejs is deployed on the same server and running two or more servers at the same time, a service user is logged on to squeeze out another user's problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.