Sticky Login across IPs

Having a problem getting Nova installed? Can't figure out why something isn't working right? This is the place to get help and report any bugs you find with Nova!

Williams Tue Nov 15, 2016 1:34 pm

Sticky Login across IPs

So I have a feeling that this isn't going to be possible with Nova 2's session method, but I figured I'd ask the question anyway.

The problem I am having lately is that when I'm at work, my PC's external IP address changes very often. I think it's more likely that we just have a range of external IP addresses, and we get load balanced onto them at random, rather than actually being assigned an IP in any way which auto-rotates. What that ultimately means is that I get logged off of Nova on an extremely regular basis while at work. This usually results in the following:

  • Write a tag or PM
  • Hit save/send
  • Get told I'm not logged in
  • Open a new tab to log back in
  • Press 'back' on the initial tab to save myself having to write everything out again
  • Hit save/send
  • Rinse and repeat

It happens often enough that I've started pre-empting it by opening a new tab before I hit save/send to re-log in first.

My question is; is there any way to make Nova recognise that I am the same user, independently of my IP address? Through a cookie that holds my session ID maybe?
Matt aka
Krace / Williams

USS HighlanderMy Xtras Profile

Posts: 288

jasoncollege24 Mon Sep 23, 2019 9:55 am

Re: Sticky Login across IPs

This is still an issue in 2019. Unfortunately, using Nova 2's session method makes it pretty well impossible to fix, because it uses the database for sessions, instead of a cookie, if I'm not mistaken. I think the only fix would be switching from database sessions to cookie sessions.

I'm actually dealing with the same issue where I'm at today. My external IP address changes every minute or so, resulting in constant logouts. Might just have to give up on Nova 2, until I go home.

This problem might be something to look into for improvement on Nova 3, if it uses the same method.

If I'm wrong on how sessions are handled, feel free to correct me!
User avatar

Posts: 183

AgentPhoenix Tue Sep 24, 2019 7:53 am

Re: Sticky Login across IPs

You're correct that Nova 2 stores sessions in the database. Honestly, I don't even remember why that decision was made. I do know that it provides the means of seeing who's online significantly easier than with cookie or file-based sessions. It also provides the ability to log someone out of the system, which you can't really do very easily with cookie-based sessions. Those are relatively minor things though.

On the Nova 3 front, Laravel provides a lot of flexibility out of the box. Right now, I have all the database structure in place for doing sessions through the database, but my installation right now is configured for file-based sessions. I can change that with a quick config update. So Laravel definitely provides the means of adjusting that.

However, CodeIgniter provides the same means, so you can certainly test out if using cookie-based sessions solves your issue. If you look in nova/core/config/nova_config.php, you'll see that there's a whole host of session config items that can be changed:

Code: Select all
$config['sess_cookie_name']      = 'ci_session';
$config['sess_expiration']      = 86400;
$config['sess_expire_on_close']   = false;
$config['sess_encrypt_cookie']   = false;
$config['sess_use_database']   = true;
$config['sess_table_name']      = 'sessions';
$config['sess_match_ip']      = true;
$config['sess_match_useragent']   = true;
$config['sess_time_to_update']   = 300;

You can copy any of these items and paste them in application/config/config.php to modify CI's default behavior. For example, use can turn off database sessions... or encrypt the session cookie, etc. Give that a spin and see if it helps.
User avatar

Posts: 7584

Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest