Skip to content

[2.1] & [3.0]: Consider disabling URL-based sessions, getting rid of PHPSESSID from URLs #8383

@sbulen

Description

@sbulen

Basic Information

See discussion here:
https://www.simplemachines.org/community/index.php?msg=4184207

It's pretty easy to make the change in Sessions.php. And yes, PHPSESSID does go away with that one line change. (Set session.use_only_cookies to true.)

I haven't experimented a lot with how far you get with cookies disabled in SMF today. I'm pretty sure you can't login anyway, i.e., you might not be losing anything at all by disabling URL-based sessions. And bots already blow up the most-online-today stats. Having PHPSESSID is the exception, not the rule these days.

While in there, we need to look closely at this logic, which rewrites the urls in head:

$buffer = preg_replace('/(?<!<link rel="canonical" href=)"' . preg_quote(Config::$scripturl, '/') . '(?!\?' . preg_quote(session_id(), '/') . ')\??/', '"' . Config::$scripturl . '?' . session_id() . '&amp;', $buffer);

This appears to be an attempt to minimize creation of multiple sessions.

Related discussion:
#8367

Steps to reproduce

Expected result

No response

Actual result

No response

Version/Git revision

3.0 Alpha 2 - current GH & 2.1

Database Engine

All

Database Version

8.4

PHP Version

8.3.8

Logs

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions