0

Is there a way to block sitecore from creating the {website}#lang cookie?

https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/cookies-used-by-sitecore.html

2 Answers 2

1

I'm not sure if it's the same processor but you might try the follow which removes the site cookie.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestProcessed>
        <processor type="Sitecore.XA.Foundation.Multisite.Pipelines.HttpRequest.StoreSiteNameInCookie, Sitecore.XA.Foundation.Multisite">
          <patch:delete />
        </processor>
      </httpRequestProcessed>
    </pipelines>
  </sitecore>
</configuration>
2
  • I tried what was suggested by both Michael and Marek. Looks like it better not to attempt this. Thank you! Commented Jun 24, 2020 at 19:47
  • Adding my custom processor in the httpRequestProcessed pipeline has worked a treat to remove the [website]#lang cookies, much better than the httpRequestEnd pipeline I initially tried. Commented May 20, 2021 at 1:25
0

As far as I know, {sitename}#lang cookie is set by the LanguageResolver processor.

There is a code

args.SitecoreContext.Language = lang;

And in the background, setter of the Language property of the context calls

  string cookieKey = site.GetCookieKey("lang");
  WebUtil.SetCookieValue(cookieKey, language.Name, expiryDate ?? DateTime.MinValue);

I haven't found any option to stop Sitecore from creating that cookie.

The only option would be to add a custom processor to httpRequestBegin processor after Sitecore.Pipelines.HttpRequest.LanguageResolver processor and in that processor remove the cookie from the response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.