I have a Laravel 5.4 App I created on a Ubuntu 14.04 with NGINX and it runs fine on https://MyDomain.TLD and https://www.MyDomain.TLD
The problem is: When I log in either(with or without www), it works fine but cookie informations are not shared to the other variant.
I did not have an issue with this in previous versions of Laravel 5+ .
Any pointers?
You need to handle www because session is saving based on domain, so try adding below code into .htaccess
file, one is for force redirection to www and one is to remove www.
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]