So, I have my symfony 4 website, using multi domain. It's not different websites, it's one website, with different languages, so I have example.com, en.example.com, ... If we log on example.com, it works, but it doesn't make the user logged in on en.example.com. I tried to set the config as I've seen in framework.yml:
framework:
session:
handler_id: ~
cookie_domain: '.localhost'
name: SFSESSION
But it simply breaks the login (there's no error but it 'triggers' a fail login, and no cookie is set. If I set 'en.localhost' as a domain, it works for that subdomain, but no others obviously.
I made a test page with that code:
<?php
$currentCookieParams = session_get_cookie_params();
$rootDomain = '.localhost';
session_set_cookie_params(
$currentCookieParams["lifetime"],
$currentCookieParams["path"],
$rootDomain,
$currentCookieParams["secure"],
$currentCookieParams["httponly"]
);
session_start();
The result is that when I access localhost, I have a php cookie (on my symfony app, a similar config leads to no cookie), but if I go to test.localhost, I have nothing.
I tried to install the apache pack ( https://symfony.com/doc/current/setup/web_server_configuration.html ) And to set
php_value session.cookie_domain ".localhost"
In the .htaccess, and it doesn't work, I login on subdomain and nowhere else; it's like the htaccess is ignored.
What am I missing ? Thank you