So I've just found out that this line breaks my session handling in my PHP application:
session_set_cookie_params($ttl, '/', '.example.com');
Pretty logical though. I shouldn't be able to set a cookie exclusive to the example.com
and assume that it will work when I run the application at a staging server in the LAN.
But to the question, what domain should I enter to make this work when running my application at my LAN-based staging server which is accessed at 192.168.1.100
?
Thanks
Just put the IP in there, it qualifies as host as well:
session_set_cookie_params($ttl, '/', '192.168.1.100');
If it's localhost, you can use it as well:
session_set_cookie_params($ttl, '/', 'localhost');
or if your server in the LAN has a hostname, put in that hostname (localhost does not work in LAN across multiple boxes naturally).
Isn't it better to make entry into your hosts
file and name your staging server?
Example row inside hosts file:
192.168.1.100 preview.example.com