Session not carried over when navigating between a domain with and without "www"


  • Sometimes, the behavior when accessing a domain with www and without www are not the same
  • For example, even if a user is logged in when accessing a domain with www pre-pended to it, when the user access the domain without www, the user is required to log in again
  • Example steps to reproduce:
    • Start a cleanbundle of Liferay DXP 7.3
    • Go to Control Panel -> Virtual Instances and add a new instance with the following information
      1. Web ID =
      2. Virtual Host =
      3. Mail Domain =
      4. Max Users = 0
      5. Active = Yes
    • In the hosts file in the local environment, add the following two entries, to access the virtual host, and the second to access the virtual host site URL
    • Go to
    • In the Site Settings section, add a new Virtual host domain for
    • Open a new tab in the same browser and go to Verify that the URL was not pre-pended with www
    • Expected Result: User is still signed in to Liferay
    • Actual Result: User is not signed in to Liferay



  • Liferay DXP 7.3


  • This issue is the intended behavior, as the virtual host is considered a different domain, even though the domains are similar, with one having a www pre-pended to it
  • This can be seen by the cookies created when accessing the URLs with and without "www"
  • The cookie can be seen by opening the browser tools -> storage -> cookies. The domains for the cookies are in line with the URL that is being accessed.
  • Based on this, it can be seen that the virtual hosts are considered completely separate entities,
  • This is why there is different behavior when accessing the 2 URLs, and why the user is required to sign in again.

Additional Information

Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0