-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookie URLs aren't build correctly #756
Comments
The above fix worked for me. Having the same problem. I was not getting redirected when logging in with the authentication page. Using nginx frontend to redirect to apache backend. |
I had the same invalid session issue as @fabsh and @doucheymcdoucherson. The problem seems to be that, when it runs behind a proxy, Selfoss builds an invalid cookie's URL: the domain is duplicated. You can see something like this in the DEBUG log:
Or this (if Selfoss is installed in a subdomain):
As the cookie's URL is build from the $cookie_domain and the $cookie_path in Authentication.php (lines 37-38), I isolated the two variables' code and its results in order to identify the problem: Code:
Results:
Solution: As you can see, part of the $cookie_path result is redundant with $cookie_domain. Actually, in the $cookie_path code there is the $_SERVER['SERVER_NAME'] variable that makes the same result as $cookie_domain, so I just removed it. And this is the new code (line 37):
I don't fully understand how the $cookie_path variable is used, but this little workaround seems to solve the problem. |
Does #766 fix your problem? |
@jtojnar No. I suppose that #766 didn't work because it changes URL building rules only in case of a normal http connection. This problem occurs in case of an https or proxy connection. However, i think your idea is good: it may allow Selfoss to get rid of the protocol verification in Autentication.php and View.php... |
This should fix fossar#756 and give a workaround for other cookie related issues.
This should fix fossar#756 and give a workaround for other cookie related issues.
As soon as I turn on login via username/password I can't get to the main selfoss page anymore. Turning on DEBUG gives the message that I am logged in but then I it reports the session isn't valid. Looking at the generated cookie, I figured out that the cookie domain is subdomain.domain.com and the path is subdomain.domain.com -- this is obviously wrong. I patched this by hardcoding my domain to subdomain.domain.com and the path to / in Authentication.php like this:
Now authentication works but this is obviously very ugly. I'm running on a Webfaction vserver. I'm guessing the $_SERVER variables are messed up somehow but know to little to know how exactly that is broken and why.
The text was updated successfully, but these errors were encountered: