1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cookies aging out

Discussion in 'Tomato Firmware' started by shadrack, Apr 13, 2010.

  1. shadrack

    shadrack Networkin' Nut Member

    Using Tomato (1.25) on my WRT54G, and it works great. So great, in fact, that most of the time, it does its job and I don't even think about it. But every now and then, I have to check on QoS and/or bandwidth. That's when I notice all my preferences for the realtime bandwidth monitor (colors, etc.) have been lost, and I have to reset them all. Anyway, long story short -- I did a little investigating and discovered that tomato sets its cookies to expire in two weeks, so if you ever go more than two weeks without logging in to the router -- *POOF* there go your preferences.

    Anybody know why the cookie lifetime is so darn short, and more importantly, how to change it?
     
  2. pharma

    pharma Network Guru Member

  3. shadrack

    shadrack Networkin' Nut Member

    Did a search. Nothing relevant as far as I can see -- including the specific thread you referenced. I am using Firefox. It's configured to keep cookies 'until they expire' (the only other options being 'until I close Firefox' and 'ask me every time' both of which would make the problem worse). The problem, again, is that the cookies are set to expire in only two weeks. Firefox doesn't control this. Tomato does.
     
  4. pharma

    pharma Network Guru Member

    If you are the only one having this problem that is not a good sign.:frown:

    The only one other thing I can suggest is you might want to try upgrading your Tomato firmware to a more current version. It is possible this was an issue with Tomato 1.25, but can not say for certain.

    Hang tight .... I'm sure you will get other suggestions!

    Pharma
     
  5. rhester72

    rhester72 Network Guru Member

    He's not, by definition. It does work that way.

    tomato.js:

    Code:
    var cookie = {
    set: function(key, value, days) {
    document.cookie = 'tomato_' + key + '=' + value + '; expires=' +
    (new Date(new Date().getTime() + ((days ? days : 14) * 86400000))).toUTCString()
     + '; path=/';
    }
    I don't know why Jon chose 2 weeks (I find it annoying as well, though only mildly so - I tend to notice for things like "per IF"), but it can certainly be modified to taste (within the context of an image build).

    Perhaps an NVRAM variable for httpd_cookie_expire_days or the like would be in order?

    Rodney
     
  6. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    shadrack shouldn't be the only person having this "problem". It's just how Tomato works. By default (if no other expiration is given), all cookies are created with 2 week expiration dates.

    To fix it, you'd have to modify the page source to provide a third parameter (is optional, defaults to 14 if not given) to cookie.set with the new expiration (in days).
     
  7. pharma

    pharma Network Guru Member

    I would second that! Surprised there are not more threads on this issue.
     

Share This Page