Infrastructure

Using Cloudflare as a Reverse Proxy for Self-Hosted Servers with Dynamic IP

Editor | February 26, 2026 | 4 min read

If you run your own server at home or on a small VPS plan, a dynamic public IP can make hosting unreliable. Your address may change, DNS records go stale, and services become unreachable.

Cloudflare can solve most of this by acting as a reverse proxy in front of your origin server. With dynamic DNS updates and proxied records, users connect to a stable domain while your backend IP can change in the background.

Why This Setup Works

Cloudflare helps in three key areas:

  • stable public domain access even if origin IP changes
  • DDoS and bot protection on proxied traffic
  • TLS termination and security controls at the edge

Combined with an automatic DNS updater, this becomes a practical self-hosting pattern.

Basic Architecture
  1. Your app runs on a server with dynamic public IP.
  2. A DDNS script/client updates your DNS record when IP changes.
  3. Cloudflare proxies the DNS record (orange cloud enabled).
  4. Users access your domain, and Cloudflare forwards traffic to origin.

This keeps user-facing access stable while origin details stay abstracted.

Practical Setup Steps
  1. Add your domain to Cloudflare and point nameservers correctly.
  2. Create an A record for your service (app.example.com).
  3. Enable proxy mode for that record.
  4. Configure a dynamic DNS updater using Cloudflare API token.
  5. Restrict origin firewall rules to only required inbound ports.
  6. Enable HTTPS mode and set strict TLS once certificates are ready.

For home networks, also set router port forwarding for required services.

Important Caveats
  • Cloudflare proxy supports specific HTTP/HTTPS ports; not every custom port is proxied.
  • Real client IP handling requires correct CF-Connecting-IP or trusted proxy config.
  • Direct-origin access should be locked down to avoid bypassing Cloudflare protections.
  • If your ISP changes IP frequently, monitor DDNS update reliability.

These details usually determine whether the setup is truly production-safe.

Final Take

Using Cloudflare as a reverse proxy is one of the most practical ways to self-host on dynamic IP infrastructure. It improves availability, security, and operational control without requiring enterprise networking complexity.