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

XF 1.2 Constantly being asked to login to AdminCP.

Discussion in 'Troubleshooting and Problems' started by Liam W, Sep 21, 2013.

  1. Liam W

    Liam W Well-Known Member

    I'm on 1.2.1 and this is starting to get annoying...

    I'm using the AdminCP, change something, click to save or do something and it says it can't be completed as I've been logged out.

    It also directs me to the login page when I try and navigate to a different area of the Admin panel.

    The admin session cookie is being set, and is set to expire at the end of the browsing session. There's no issue on the front end login, so why is this happening?

    My cookie settings are also OK, and it isn't happening on my test (localhost) install.

    Liam
     
  2. The Sandman

    The Sandman Well-Known Member

    I'm seeing this at time as well - thought it was me. :)
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

  4. The Sandman

    The Sandman Well-Known Member

    No proxy for me. And happening with IE 10.
     
  5. Liam W

    Liam W Well-Known Member

    I'm using CDN Net, if that counts? Otherwise, no.

    @Jeremy actually, yes, REMOTE_ADDR is showing the IP of cdnnet. I have a way to (sort of) fix this though, for now at least.

    I added this to the bottom of your config.php:

    PHP:
    function getIp() {
        
    $ip $_SERVER['REMOTE_ADDR'];
        if (!empty(
    $_SERVER['HTTP_CLIENT_IP'])) {
            
    $ip $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty(
    $_SERVER['HTTP_X_FORWARDED_FOR'])) {
            
    $ip $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        return 
    $ip;
    }

    $_SERVER['REMOTE_ADDR'] = getIp();
    After doing that, my correct IP is shown on the list of online users, as CDN.net adds the other headers.

    Obviously, it should be taken with a pinch of salt as headers can be modified, but isn't that the case for the main one as well?

    I'll soon see if this fixed the admincp issue :)
     
    Last edited: Sep 21, 2013

Share This Page