Issue with WordPress and Varnish breaking loadscript.php

I’ve hit a snag with a Varnish – Nginx – WordPress set up. The server is running multiple Joomla based sites (all fine) and should be running one WordPress one too apart from it breaks with Varnish.

Basically when Varnish is enabled I get the following error:

Read More

Uncaught ReferenceError: _ is not defined on the Dashboard and various JQuery not defined errors elsewhere.

With Varnish off it all works perfectly. I’m scratching my head now as to where the issue lies with my Varnish set up. I can’t find anything on the web that is a similar issue and any help would be appreciated!

Related posts

Leave a Reply

2 comments

  1. I just stumbled on this issue today. You didn’t post your configuration, but my guess is that you might be using querysort to normalize your query parameters.

    I found that querysort really doesn’t like the load-scripts.php URLs. In a lot of cases, it ends up truncating the URLs. If you’re using it, I recommend either not using it or making a special condition for it like:

    if (req.url !~ "load-scripts.php") {
      set req.url = std.querysort(req.url);
    }
    
  2. Further to Carl’s answer I found that stopping querysort for the whole wp-admin helped with this error within other plugins.

    if (req.url !~ "wp-admin") {
      set req.url = std.querysort(req.url);
    }