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
- Web ID = www.test.org
- Virtual Host = www.test.org
- Mail Domain = liferay.com
- Max Users = 0
- 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
- 127.0.0.1 www.test.org
- 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
Conteúdo Excluesivo para Assinantes
Uma Subscrição do Liferay Enterprise fornece acesso a mais de 1.500 artigos que incluem práticas recomendadas, solução de problemas e outras soluções valiosas. Faça login para obter acesso completo.
Entrar