Intermitten 521 error in front of Digital Ocean and Wordpress Multisite

Hi all,

I am having getting intermittent 521 error code. Here is a bit explanation about the architecture. I have a wordpress multisite server to serve client sites. The webserver is NGINX with PHP-FPM Every site has its own domain, so for every client site, I have one Cloudflare account that connects to the wordpress.

Somewhat I have been getting intermittent 521 errors in all the sites to the server after some change in configuration (which I kind of forgot which one).

Before the errors, basically the Cloudflare configuration has

  1. A name from the site to the multisite IP address
  2. flexible ssl enabled
  3. https rewrite and https redirect enabled
  4. 1 page rule to redirect *.domain to www.domain.
  5. 1 page rule to bypass cache to wp-admin
  6. 1 page rule to cache all content under wp-content/*

But then suddenly the 521 errors happening to all microsites. What I tried to fix are

  1. install SSL in multisite, set the domain to CNAME, set the HTTPS to Full (from Flexibe).
  2. test enabling the development mode

Somewhat the problem still persist, so I tried curl one of the site and see the log in the nginx.

Above is example of the log. On the first section, on the left, I tried to curl based on timestamp while the right is the nginx log. In the 155xxxxxxx033 I got 521 Origin Down but there is no entry in the right. Only the previous 155xxxxxxxx00994 and next 155xxxxxx8901.

After that, I tried again with changing the HTTPS configuration from Flexible to Full. Still the same. See in the second section of the picture above (new user can only post 1 picture :frowning_face:)

I am now stuck in where to investigate next and what configuration I am missing. Really appreciate help and ideas.