Using WordPress Jetpack with Nginx and Varnish

I need to manage a few WordPress sites and I wanted to add the Jetpack plugin so I can manage all sites from a account. After having installed the Jetpack plugin, trying to manage my site from fails with this error:
Screen Shot 2015-07-03 at 23.25.44

Watching the Varnish log, I tried the same call made by with curl. The endpoint /xmlrpc.php is called via POST, and curl gave me another hint:

<?xml version="1.0" encoding="UTF-8"?>
 <value><string>parse error. not well formed</string></value>

The error -32700 is not really useful, but a search on DuckDuckGo gave me the solution:

Add this line to the beginning of the wp_config.php file of your site:


And voila, it works.

Almost everybody seems to agree on Varnish being the problem, but the solutions given did not work for me. Just in case, the solutions mentioned were to tell Varnish to ignore the calls to /xmlrpc.php.