Break up a long line in a .htaccess file

Solution 1:

The following should work:

 Header set Content-Security-Policy "default-src http://domainA.com; \
      script-src http://domainB.com"

Solution 2:

Yes - the backslash works as a line-continuation. This is buried within the Apache 2.4 documentation on [https://httpd.apache.org/docs/2.4/configuring.html#page-header]

Important rules:

  1. Whitespace within a line is fine, ie. any number of tabs and spaces;
  2. The last character on all lines except the final one must be a backslash;<
  3. The final line must not terminate with a backslash;
  4. The Apache comment character (#) cannot be used to comment out a line.

If these rules are not obeyed, the server will respond with an Error 500.