Configuring an External CDN

You can use your content delivery network (CDN) with Salesforce B2C Commerce to deliver static and dynamic imaging service (DIS) content to your customers. Deploy your CDN (or a reserve proxy) in front of B2C Commerce to improve performance and security, or provide additional functionality.

Note: Review the CDN documentation.

A CDN can be used for the following:

Customer CDN settings are instance specific. They are not transferred to other instances with the Data Replication process.

Layer your CDN in front of the B2C Commerce servers. Specify the URL prefix used to create the URLs pointing to your CDN.

Important: If you use the CDN that is included in B2C Commerce, don't change the following settings.
  1. Select site > Merchant Tools > Site URLs > Customer CDN Settings.
  2. On the Customer CDN Settings page in the Dynamic Content section, enter the Client IP Header Name.

    This value is used by the CDN to transfer the client's IP to the B2C Commerce servers to enable client IP based services, such as geo-location. B2C Commerce uses this setting to retrieve the client IP address from a request header instead of the network connection source address. If the request header isn't provided, the connection source address is used. If a CDN terminates client requests, B2C Commerce continues to use the client IP header name functionality. See the CDN documentation.

    B2C Commerce prohibits use of the following header names:

    • cf-connecting-ip
    • true-client-ip
    • x-forwarded-for

    Configuration

    • On the B2C Commerce instance: select site > Merchant Tools > Site URLs > Aliases and configure the site name.
    • On the DNS: point the DNS entry for your site to your CDN CNAME.
    • On the CDN:
      1. Enter the B2C Commerce instance as the origin server, for example, production-realm-customer.demandware.com.
      2. Pass the host header to the origin.
      3. Configure the client IP header name as specified.
      4. Ensure responses are only cached in the CDN if the origin sends a cache header.
  3. In the Static Content section, enter the Static CDN Root for http and https.

    Modify the static content URLs to use the CDN hostname and path prefix. Static and dynamic hostnames can be different. CDN roots for http and https can be different.

    Configuration

    • On the DNS: point the DNS root hostnames entries to the CDN.
    • On the CDN: construct the request to origin as follows:
      • Use the http or https protocol of the incoming request.
      • Enter the B2C Commerce instance as the origin server, for example, demandware.dw.demandware.com.
      • Remove the configured path prefix from the incoming URL path and forward the remainder of the path, for example, if /static is the path prefix, then the incoming path /static/on/demandware becomes /on/demandware.
    • Ensure responses are cached in the CDN in accordance with the returned cache header, for optimum performance
    • DIS URLs change when file content changes. No special cache invalidation logic is required.
  4. In the Dynamic Imaging Service (DIS) section, enter the DIS CDN Root for http and https.

    Modify the DIS URLs to use the CDN hostname and path prefix. CDN roots can be the same for http and https. The CDN root for DIS and static content requests must be different.

    Configuration

    • On the DNS: point the DNS root hostnames entries to the CDN.
    • On the CDN: configure the request to origin as follows:
      • Use the http or https protocol of the incoming request.
      • Enter the B2C Commerce instance as the origin server, for example, demandware.dw.demandware.com.
      • Remove the configured path prefix from the incoming URL path and forward the remainder of the path, for example, if /dis is the path prefix, the incoming path /dis/dw/image becomes /dw/image.
    • Ensure responses are cached in the CDN in accordance with the returned cache header, for optimum performance.
    • DIS URLs change when file content changes. No special cache invalidation logic is required.
  5. Click Save (at the top right).