I'm using Cloudflare and I want to protect my origin server from accepting any traffic that is not Cloudflare.
I was thinking to just IP whitelist https://www.cloudflare.com/ips/
However, I notice that they add/remove IPs every year or two. So I worry that one day people will get errors and it'll be because Cloudflare added or changed the list.
Another option I was thinking is injecting a secret header via Cloudflare and have it go through to origin server and origin server would verify that secret header is correct otherwise reject.
Is there a best practice that I should use here?