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

Issue

  • 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 = www.test.org
      2. Virtual Host = www.test.org
      3. Mail Domain = liferay.com
      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
      1. 127.0.0.1 www.test.org
      2. 127.0.0.1 test.org
    • Go to www.test.org:8080
    • In the Site Settings section, add a new Virtual host domain for test.org
    • Open a new tab in the same browser and go to test.org:8080. 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

 

Environment

  • Liferay DXP 7.3

Resolution

  • 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