Skip to Content
Sep 22, 2015 at 10:13 AM

Single Domain, Multiple sites - Cookie issue?


We need 2 websites in our shop. The urls are localhost:9001/mystorefront/site1 and localhost:9001/mystorefront/site2. When I have opened 1 site and if I try to open next site in other tab then it is showing page not found. I found out that this issue is due to cookie setup. There is a cookie like "localhost:9001/mystorefront/"

I have changed EnhancedCookieGenerator like this.

From: cookie.setPath(request.getContextPath());

To: cookie.setPath(request.getContextPath() + request.getServletPath());

After the change, If I see my cookies in my browser there is cookie like "localhost:9001/mystorefront/site1/" but the cookie "localhost:9001/mystorefront/" is also still there.

The problem still is there. Any suggestions will be helpful.