I'm trying to use Cloudflare for SaaS to have a bunch of custom domains point to my webapp.
This works fine for wildcard subdomains of my root domain, but I realized that I need a default route to use the custom domains.
I've been reading the docs but can't seem to figure out the right syntax to achieve this:
I'm running on k3s so using the pre-installed traefik with this ingress config:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
namespace: prod
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: mydomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: webapp-service
port:
number: 3000
- host: HostRegexp(`{catchall:.*}`)
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: webapp-service
port:
number: 3000
tls:
- hosts:
- "mydomain.com
secretName: cloudflare-cert
- hosts:
- "*"
secretName: cloudflare-cert