Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:54:14+00:00 2026-06-01T12:54:14+00:00

I have a problem with nodejs and connect and the fact that it’s not

  • 0

I have a problem with nodejs and connect and the fact that it’s not keeping the session variables between requests. For now I don’t want to use a db to store my sessions. I just want to use the MemoryStore.

My server:

var server = connect()
.use(connect.cookieParser('justmeknowsthis'))
.use(connect.session({ cookie: { maxAge: config.data.sessionTimeout /* 1800000 */ }}))
.use(auth.authorize)
.use(routes.routes)
.use(function(req, res, next) {
    utils.data.returnJsonError(res, 404, true, {
        message: 'Call not supported'
    });
});

I’m setting a session variable like this:

req.session.auth = true;
req.session.username = data.username;

After finding some more information about the issue I’ve noticed that it’s probably to do with the time zone as it starts working if I just increase the timeout. From my past experiences using ASP.Net I’ve never encountered the issue before as it doesn’t seem to care about that.

How can I get around this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:54:16+00:00Added an answer on June 1, 2026 at 12:54 pm

    Ok. So finally figured out how to do it. After reading a lot about how stupid I am for not running my server in UTC I decided to give it a try. I’m on ubuntu and here’s the solution to get the cookies to work correctly.

    Run:

    sudo dpkg-reconfigure tzdata
    

    Select “Etc” from the list of “Geographic areas”
    Select UTC and press Enter

    UPDATE
    I noticed that my server time drifted quite heavily (virtual machine) so I also had to use a ntp-daemon to have it keep time properly. Setup is below:

    sudo apt-get install ntp
    

    You’ll need to stop the ntp-daemon to be able to update it manually the first time. You can also reboot the server but it’s Linux so you shouldn’t have to. Run the below to stop the daemon:

    sudo /etc/init.d/ntp stop
    

    Update the server time manually (use a server close to you from http://www.pool.ntp.org/en/):

    ntpdate ntp.ubuntu.com pool.ntp.org
    

    Just re-start the daemon again:

    sudo /etc/init.d/ntp start
    

    Also update the file /etc/ntp.conf and include your local time servers.

    UPDATE AGAIN
    After running a day I noticed that the time is still off. I’ve now turned the UTC option off for the VM machine. This unfortunately also requires a reboot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem with Tikz/Latex: I have some nodes that contain text.
I have problem with fancybox. I want to write a function that will run
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']
Hi now I know that NodeJS is asynchronous (which I am still trying to
I have the following problem: I'm using Redis with NodeJS together via mranney's driver
I have a graph I've created in graphviz, but the problem is that edges
I have an nodejs chat app where multiple clients connect to a common chat
I have a blogging system that stores uploaded files into the GridFS system. Problem
I am working on the shortest path problem , this means that I have
I have a strange WPF/XAML problem. By default, I want all of the nodes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.