News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Login 'forgotten' on alternate click weirdness.

Started by foxbat, November 06, 2015, 03:57:26 AM

Previous topic - Next topic

foxbat

Hi,

I recently moved my forum from shared hosting to my own VPS and noticed some strange behaviour with logins. The login status seems to be lost on every alternate click. That is, when I login and view a board's list of messages or a single message then the page is rendered correctly and the URL in the address bar is:

hxxp:andybrown.me.uk/forum/index.php/topic,69.0.html?PHPSESSID=foobarbaz [nonactive]

However if I then hover over the breadcrumb link at the top of message it shows me that the URL is missing the PHPSESSID query string:

hxxp:andybrown.me.uk/forum/index.php/topic,69.0.html [nonactive]

and clicking on it re-renders the message as if I am logged out but hovering over the breadcrumb now shows:

hxxp:andybrown.me.uk/forum/index.php/topic,69.0.html?PHPSESSID=bazbarfoo [nonactive]

and clicking on it renders the message with all the logged in options. Note however that the PHPSESSID variable is not the same as the first time. And so it continues alternately losing and regaining logged in status, albeit with different PHPSESSID values.

This is tested on Windows with Chrome/Firefox/Edge and Chrome on Android. Navigating the admin and moderation options is unaffected by this.

The forum URL is: hxxp:andybrown.me.uk/forum [nonactive]. The old forum URL on the shared host was subtly different: hxxp:www.andybrown.me.uk/forum [nonactive]. Enabled cookie/session settings are local storage, database driven, allow go back to cached pages. I am using the Varnish page cache on my VPS and did not have this on the shared host.

Settings.php looks good. Is there anything in the database that could cause this? I noticed that the wk_themes table still has rows in there that reference the old URL (e.g. 'theme_url' = 'hxxp:www.andybrown.me.uk/forum/Themes/default'). [nonactive]

I'm a Linux server developer with 20 years experience so please don't hold back on the technical detail - I will understand you :)

Kindred

when you moved the forum -- did you load and run repair_settings.php?
Did you adjust all of your themes to the new URL?


And, did you remove cookies and/or create a new cookie name to force systems to use the cookie of the new domain? (unless you have subdomain independent cookies, www.blah.com is a different domain from blah.com)

If none of that has any beneficial result, I would try disabling varnish.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

foxbat

It's varnish. Damn. I'll figure out a way to exclude the forum URL root from caching. Thanks for the tip!

[edit] If anyone else is running varnish, has the forum on a sub-url (not subdomain) and needs to exclude it from caching. Just add a rule to the vcl_recv function in default.vcl that looks for an identifying part of your URL. e.g. for my case:


    if (req.url ~ "/forum/") {
        return(pass);
    }


This excluded the forum from caching without affecting the rest of the site.

Advertisement: