Using Caddy with Cloudflared Argo tunnel and DNS wildcard

to use a reverse proxy with a CNAME wildvard DNS, hostname and originServerName need to have the same value of *.domain.xyz

working config.yaml:

tunnel: UUID
credentials-file: /etc/cloudflared/UUID.json

ingress:
  - hostname: '*.domain.xyz'
    service: https://192.168.0.101:443
    originRequest:
      originServerName: '*.domain.xyz'
  - service: http_status:404

then just use caddyfile:

{
    acme_dns cloudflare mytoken
}

*.domain.xyz {

  @service1 host service1.domain.xyz
  reverse_proxy @service1 192.168.0.101:1234

  @service2 host service2.domain.xyz
  reverse_proxy @service2 192.168.0.101:5678
	
}
1 Like