caddy_reverse_proxy_default_handler: - handler: static_response status_code: 404 caddy_reverse_proxy_config: apps: http: servers: rproxy: listen: "{{ ['tcp4/:443', 'tcp6/:443'] if host_tls else ['tcp4/:80', 'tcp6/:80'] }}" listener_wrappers: "{{ [{'wrapper': 'http_redirect'}, {'wrapper': 'tls'}] if host_tls else [] }}" automatic_https: disable: yes tls_connection_policies: - match: sni: - "{{ host_fqdn }}" default_sni: "{{ host_fqdn }}" routes: - handle: "{{ (caddy_reverse_proxy_handlers | d([])) + caddy_reverse_proxy_default_handler }}" terminal: true