Cloudflare x OpenVPN 522 error: can't connect to home server

Hi all, I’ve been struggling with this issue for a while, hopefully you can shed some light.

Problem: 522 error when trying to access my server, when OpenVPN on router is turned on.

Context:

  • A cloudflared domain points at my static WAN IP, so I can access the services of my home server via the internet.
  • I have OpenVPN running on my router, with the router bypassing the vpn.
  • I have a Pihole running as an addblocker, recursive DNS and DHCP server, with limited reserved addresses and some static leases.

Expected behaviour: OpenVPN on router to stream outside of my region, while still being able to access my server via dedicated domain which translates to my static WAN IP.

Experienced behaviour: When the OVPN is on, Cloudflare can’t connect to my server and gives a 522 error

Where I think to look for the problem / what I tried:

  • Turning the VPN off allows acces to my server.
  • Taking PiHole out of the occasion makes no difference.
  • Grep ifconfig on router shows the correct static WAN IP.
  • My A record in Cloudflare points at the correct static WAN IP and is proxied (yellow cloud).
  • DIG returns A records pointing at Cloudflare servers, which makes sense as Cloudflare my domain is proxied by Cloudflare (orange cloud)