loading table of contents...

3.4.5. Configuring the Cookie Domain

[Note]Note

This is only necessary in the content-led scenario or when you use AJAX calls (for Elastic Social, for example) in the commerce-led scenario.

Since the CAE must know about generated commerce cookies and vice versa, it is necessary to configure specific cookie domains for both, the CAE and the commerce system, so that cookies are exposed to both systems.

The CoreMedia system must be hosted on servers belonging to the same domain. Example: If the domain given here is .xyz.com, then the CoreMedia CAE must be accessed from the WCS via a (logical) server name servername.xyz.com.

In order to enable session synchronization between the CoreMedia and IBM system do the following steps:

  1. Enable the com.coremedia.livecontext.hybrid.CookieLeveler within the web.xml of your commerce store front(WCDE-INSTALL/workspace/Stores/WebContent/WEB-INF/web.xml) and preview(WCDE-INSTALL/workspace/Preview/WebContent/WEB-INF/web.xml) webapp. Put its filter mapping in front of all other filter mappings and set the cookie domain to the shared domain of your CAE and WCS.

    <filter>
      <filter-name>Cookie Leveler</filter-name>
      <filter-class>com.coremedia.livecontext.hybrid.CookieLeveler</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>Cookie Leveler</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <context-param>
      <param-name>com.coremedia.fragmentConnector.cookieDomain</param-name>
      <param-value>.blueprint-box.vagrant</param-value>
    </context-param>
  2. If you want to rewrite additional cookies of your own commerce customizations, you can configure a list of all cookies to be rewritten via a comma separated list.

    <filter>
      <filter-name>Cookie Leveler</filter-name>
      <filter-class>com.coremedia.livecontext.hybrid.CookieLeveler</filter-class>
      <init-param>
        <param-name>cookieFilter</param-name>
        <param-value>WC_,WCP_,myCustomCookie</param-value>
      </init-param>
    </filter>

    Per default commerce cookies starting WC_ and WCP_ are mapped.

  3. Set the cookie domain for the JSESSION cookie on the commerce server, for example via the IBM console.

For the CAE the cookie domain is configurable in the Tomcat configuration file context.xml. The cookie domain can be set here by setting the attribute sessionCookieDomain for the Context element. The cookie domain must be configured with a leading "." so that the CAE session cookie is readable from commerce system that run with the same subdomain, for example .myDomain.com.