[GH-ISSUE #226] Cannot serve Cypht over custom port number #189

Closed
opened 2026-02-25 21:34:23 +03:00 by kerem · 4 comments
Owner

Originally created by @justinvoelker on GitHub (Oct 8, 2017).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/226

Originally assigned to: @jasonmunro on GitHub.

When trying to use Cypht over a custom port number (anything other than port 80), users are automatically and immediately singed out. I have traced the issue back to the validate_source() method within lib/module.php. There is an "if" statement that essentially compares source to target and when served over a custom port, the if statement ends up trying to compare the target of "192.168.1.101:8080" to the source of "192.168.1.101" which causes the problem. This difference causes the session to be destroyed.

Originally created by @justinvoelker on GitHub (Oct 8, 2017). Original GitHub issue: https://github.com/cypht-org/cypht/issues/226 Originally assigned to: @jasonmunro on GitHub. When trying to use Cypht over a custom port number (anything other than port 80), users are automatically and immediately singed out. I have traced the issue back to the validate_source() method within lib/module.php. There is an "if" statement that essentially compares source to target and when served over a custom port, the if statement ends up trying to compare the target of "192.168.1.101:8080" to the source of "192.168.1.101" which causes the problem. This difference causes the session to be destroyed.
kerem 2026-02-25 21:34:23 +03:00
Author
Owner

@jasonmunro commented on GitHub (Oct 9, 2017):

Thanks for the report. This is a bug and I will get it fixed ASAP.

<!-- gh-comment-id:335052788 --> @jasonmunro commented on GitHub (Oct 9, 2017): Thanks for the report. This is a bug and I will get it fixed ASAP.
Author
Owner

@jasonmunro commented on GitHub (Oct 9, 2017):

Should be fixed, if you could retest that would be great. Thanks!

<!-- gh-comment-id:335230799 --> @jasonmunro commented on GitHub (Oct 9, 2017): Should be fixed, if you could retest that would be great. Thanks!
Author
Owner

@justinvoelker commented on GitHub (Oct 11, 2017):

That appears to have fixed it as I can see the code is now getting past that point.

However, I am still just being redirected to the login page after authentication when I use a custom port so something else must be kicking me out. I will log another issue when I figure out what is causing that.

<!-- gh-comment-id:335644788 --> @justinvoelker commented on GitHub (Oct 11, 2017): That appears to have fixed it as I can see the code is now getting past that point. However, I am still just being redirected to the login page after authentication when I use a custom port so something else must be kicking me out. I will log another issue when I figure out what is causing that.
Author
Owner

@jasonmunro commented on GitHub (Oct 12, 2017):

@justinvoelker I had to make 2 changes to get this working, one in the origin check you pointed out, and the other when setting cookies, because the port number was incorrectly being included in the domain field in the cookie. Not sure if that is related to what you are seeing.

<!-- gh-comment-id:336175447 --> @jasonmunro commented on GitHub (Oct 12, 2017): @justinvoelker I had to make 2 changes to get this working, one in the origin check you pointed out, and the other when setting cookies, because the port number was incorrectly being included in the domain field in the cookie. Not sure if that is related to what you are seeing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#189
No description provided.