Site is not working when CloudFlare Proxy is enabled

My new client’s website was on a hosting account owned by her old web designer (who had set it up on CloudFlare) who basically stopped answering my client’s calls. The site eventually started displaying an error that says “Error establishing a database connection.”

My client had a backup of the site from a few weeks ago, so I helped her migrate it over to a new host using the backup. I set up her Cloudflare account, pointed her nameservers to the new Cloudflare account, and uploaded the backup.

Everything works fine when I have the Cloudflare proxy off, but when I turn it on, I start seeing the “Error establishing a database connection” message again. It’s like the proxy is pulling up the old site, which to my knowledge is still on the old hosting account. Any idea why this is happening and how to fix it? The nameservers have fully propagated:

Here’s the DNS setup in Cloudflare:

Does anyone have any ideas on why this is happening and how to fix it?

Is there any error logs from the server?

The only logs I have access to are an access log, PHP log, and slowlog. I’m hosting with Flywheel.

Previously without Cloudflare proxy, is your site in HTTP or HTTPS?

And, what’s your SSL encryption mode? Flexible or Full (strict)?

1 Like

Check if your site move http to https by htaccess (modrewrite) or nginx.
And then check SSL tab in cloudflare. Seem it conflict.

1 Like

Thanks, the old site was also using http(s). I have SSL set to Full.

Flywheel doesn’t use htaccess, they use nginx.

In that site’s wp-config.php file, what is the hostname in:
define( 'DB_HOST', 'HoStNaMe' );

151.101.*.159 is new hosting or old hosting? Seem it’s working on this server right now!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.