r/CloudFlare: Using DDNS with WAF IP Source Address

r/CloudFlare: Using DDNS with WAF IP Source Address
💡
This article archives a conversation, which took place in a subreddit post (original source linked below) and to which I contributed a solution or answer (with the u/MasterofSynapse handle), in a Q&A format.

Original Reddit post: https://www.reddit.com/r/CloudFlare/comments/yiistk/using_ddns_with_waf_ip_source_address/

Question

I have a dynamic IP and I want to restrict access to some A records to only my IP. I have it working if I manually put my IP into my list but I would rather rely on my DDNS host to make it painless. This is also for mobile access on my phone where the IP changes all the time.

Is there a way to do this?

Answer

Take a look at Cloudflare Zero Trust and Cloudflare Tunnel. With that you can add authentication to your apps and the IP filter is not needed anymore. Access via smartphone is possible through that as well.