Using $_SERVER['HTTP_HOST'] instead of $_SERVER['SERVER_NAME'] for the cookies_domain, if possible.

Thanks, @hansfn.