mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Absolute alternate_base_url no longer breaks session cookies
This commit is contained in:
parent
f2d3026e93
commit
6dde5ce571
@ -359,6 +359,15 @@ class Session {
|
|||||||
$path = Config::inst()->get('Session', 'cookie_path');
|
$path = Config::inst()->get('Session', 'cookie_path');
|
||||||
if(!$path) $path = Director::baseURL();
|
if(!$path) $path = Director::baseURL();
|
||||||
$domain = Config::inst()->get('Session', 'cookie_domain');
|
$domain = Config::inst()->get('Session', 'cookie_domain');
|
||||||
|
// Director::baseURL can return absolute domain names - this extracts the relevant parts
|
||||||
|
// for the session otherwise we can get broken session cookies
|
||||||
|
if (Director::is_absolute_url($path)) {
|
||||||
|
$urlParts = parse_url($path);
|
||||||
|
$path = $urlParts['path'];
|
||||||
|
if (!$domain) {
|
||||||
|
$domain = $urlParts['host'];
|
||||||
|
}
|
||||||
|
}
|
||||||
$secure = Director::is_https() && Config::inst()->get('Session', 'cookie_secure');
|
$secure = Director::is_https() && Config::inst()->get('Session', 'cookie_secure');
|
||||||
$session_path = Config::inst()->get('Session', 'session_store_path');
|
$session_path = Config::inst()->get('Session', 'session_store_path');
|
||||||
$timeout = Config::inst()->get('Session', 'timeout');
|
$timeout = Config::inst()->get('Session', 'timeout');
|
||||||
|
Loading…
Reference in New Issue
Block a user