Using Classic Live Preview Across Multiple Subdomains

This guide only applies to categories, as of Craft 3.2 and later. See Using Live Preview With An Alternate Control Panel Domain for previewing entries across multiple domains.

If your site has multiple locales whose base URLs span across multiple subdomains, you will need to make some special configuration changes in order to get Live Preview in cross-domain scenarios.

As an example, let’s say your site has two locales: English (located at, and German (located at If you are accessing the control panel from and edit an entry’s German translation, you will likely get a JavaScript error about a cross-domain security restriction if you try to open Live Preview.

To work around this, two changes must be made:

  1. Open craft/config/general.php and set the defaultCookieDomain config setting to '':

    'defaultCookieDomain' => '',

    This will cause user session cookies generated by Craft to apply to all subdomains of your domain name, so user sessions can persist across them.

  2. Open up the .htaccess file in each of your public web-roots, and add the following code to them:

    Header set Access-Control-Allow-Origin ""
    Header set Access-Control-Allow-Credentials true

    On the first line, replace with the domain name you will be accessing the control panel with.

Once those changes have been made, you will need to either clear your browser’s cookies or restart the browser, so the new defaultCookieDomain config value can take effect.

Applies to Craft CMS 3.