• I’m not sure if this is a multisite problem or a theme problem but I only experience the problem with this theme on multisite installs.

    The theme is wordpress bootstrap from 320press.

    When load the less css files I am seeing an XMLHttpRequest error.

    You can see the error at https://tracesofviolet.com in your browser console.

    TIA,
    Tim J

Viewing 3 replies - 1 through 3 (of 3 total)
  • XMLHttpRequest cannot load https://mainarray.com/uzsources/themes/wordpress-bootstrap/less/bootstrap.less. Origin https://tracesofviolet.com is not allowed by Access-Control-Allow-Origin.
    Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 less-1.3.0.min.js:8
    Failed to load resource: the server responded with a status of 403 (Forbidden) https://mainarray.com/?dm=d464f9a576471eb6022ae43976fb42b5&action=load&blogid=3&siteid=1&t=2028029890&back=http%3A%2F%2Ftracesofviolet.com%2F

    It looks like the errors are mainly Access Control Allow Origin because the theme is pulling the .less files from the mainarray.com domain.

    The theme is using get_template_directory_uri(). To load the stylesheets which should return the current sites domain as the base but they are loading from the mainarray.com domain. Also to note the wp-content directory has been changed to uzsources. Are you following the Codex guidelines for moving wp-content?

    You can fix this by adding the following line to your virtual host file

    Header add Access-Control-Allow-Origin "https://mainarray.com"
    Header add Access-Control-Allow-Origin "https://tracesofviolet.com"

    The root of the problem is the wrong domain being called from get_template_directory_uri.

    Thread Starter Timjwp

    (@timjwp)

    Thanks for the response Chris.

    I’m not sure you are correct. All css and js files are loaded within the theme using get_template_directory_uri() but only the less file is throwing an error. I think it has something to do with how less is generated.

    The theme is using get_template_directory_uri(). To load the stylesheets which should return the current sites domain as the base but they are loading from the mainarray.com domain.

    As stated this is multisite install. My other sites and themes on this install load styles, images etc. from mainarray.com (the domain which WordPress MU is installed on) without error.

    Also to note the wp-content directory has been changed to uzsources. Are you following the Codex guidelines for moving wp-content?

    The content directory was renamed using the Better WP Security plugin which has never been a problem before and again, if it were the cause, I would be seeing the error on other sites on the network. However, before I came here I did disable all my plugins just in case.

    You can fix this by adding the following line to your virtual host file

    Header add Access-Control-Allow-Origin “https://mainarray.com”
    Header add Access-Control-Allow-Origin “https://tracesofviolet.com”

    Shouldn’t this be avoided for security?

    Thanks

    Did a little research on the way the less.js parses the .less files. It is using a XMLHttpRequest which basically requires that the files are loaded from the same domain name or “Origin” as the site they are loaded on.

    As the Header add Access-Control-Allow-Origin doesn’t work you have 2 options. The first is to hard code the less files in the themes header.php

    <link rel="stylesheet/less" type="text/css" href="https://tracesofviolet.com /uzsources/themes/wordpress-bootstrap/less/bootstrap.less">
     <link rel="stylesheet/less" type="text/css" href="https://tracesofviolet.com /uzsources/themes/wordpress-bootstrap/less/responsive.less">

    As stated this is multisite install. My other sites and themes on this install load styles, images etc. from mainarray.com (the domain which WordPress MU is installed on) without error.

    This is fine for CSS, javascript and other static files but won’t work for the .less files.

    The file requests should come from the same domain. You can fix this by going to your network admin sites menu under the site settings tab and add https://tracesofviolet.com/ as the Siteurl.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘less css w/ multisite’ is closed to new replies.