Dynamic wildcard routing with Pages?
I want to serve my static website through Cloudflare pages and have 4 wildcard urls routed to my Kubernetes cluster.
Currently, my static website is served from a Docker container in my Kubernetes cluster, and Cloudflare proxies to my cluster's ingress IP address. All my DNS is managed in Cloudflare.
One approach, I thought, would be to create a new subdomain, backend.apex.tld, and use Cloudflare URL Rewrite rules, to send the 4 wildcard routes to the K8s cluster, and all other traffic routed to Cloudflare pages. However Cloudflare URL Rewrite rules do not allow dynamically routing to a different hostname.
Will Cloudflare Snippets allow me to do this?
In the worst case, I can temporarily have an nginx container proxy to Cloudflare pages. But would like to hear what a better way to do this might be.
2 Replies
oh hmm, maybe I'm looking for something like this https://github.com/flaregun-net/proxyflare-for-pages
GitHub
GitHub - flaregun-net/proxyflare-for-pages: 🔥 A reverse proxy fo...
🔥 A reverse proxy for your Cloudflare Pages domain - flaregun-net/proxyflare-for-pages
I would prefer to use Cloudflare functionality directly