Keeping test environments separate.
THE PROBLEM
A staging site behind Cloudflare with caching enabled serves stale content, and changes appear not to take effect.
That wastes considerable time.
THE SENSIBLE CONFIGURATION
Set the staging subdomain to DNS only. Traffic goes directly to us, with no caching in the way.
PROTECTING IT
cPanel Directory Privacy on the staging directory. A server-level password prompt.
That also prevents search engines indexing it, which is the other staging problem.
WHAT NOT TO DO
Rely on a Cloudflare rule alone to block access to staging. A rule can be misconfigured; a password cannot be bypassed.
IF STAGING MUST BE PROXIED
Create a page rule bypassing cache entirely for that hostname.
And add a firewall rule restricting access to your own addresses.
WHEN YOU PUSH TO LIVE
Purge the Cloudflare cache for the live site afterwards, or visitors continue seeing the previous version.
THE HABIT
After any deployment: purge the application cache, then Cloudflare, then test in a private window.