I have b2c and b2b site. When a b2b customer logs out it should be redirected to b2c site homepage.
I tried below. It works for other sites like "www.google.com" but redirecting to another cmssite doesn't work.
httpResponse.sendRedirect(encodedRedirectUrl);
Also I tried setting target cmssite to currentSite before redirect but no luck
I believe the session site and other parameters are not cleared from current site or populated for target site. Guide me the right way to do it.
There are two things you need to know about CMS sites and the session:
What you need to do is:
Either:
Clear the CMS site from the session BEFORE doing the redirect, so the CMS site filter is forced to determine the CMS site once again.
OR:
Replace the b2b site with the b2c CMS site in the session when logging off. Then do the redirect.
Check these classes:
my.storefront.filters.cms.CMSSiteFilter
especially the method: processNormalRequest
de.hybris.platform.acceleratorcms.context.impl.DefaultContextInformationLoader#initializeSiteFromRequest