Bad Gateway - error 521 than 502 after setting Cloudflare DNS

Hello, I linked my domain to my wordpress application and everything works. but when I change the DNS to configure CloudFlare, nothing else works and host error. normally everything works fine i can not find the problem. no firewall and the server is UP.

thanks again


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I resolve the problem with “Really Simple SSL” plugin WP

I had the same problem when I pointed my website to my new IP. Originally I was with SiteGround but switched hosting to a one click WP Digital Ocean install (Ubuntu 18.04). After updating my DNS with CloudFlare my website went down (both 521 & 502 errors). The fix for me was turning SSL to Off (Flexible allowed the site to open but the format was all messed up). I have an active SSL certificate so I am not really clear as to why it wasn’t working… Will do some more research but for now I am just glad to have my site back up and running.

Are you able to access your site by the IP address directly? A 521 error from CloudFlare indicates that your web server refused the request sent through from CloudFlare.