In k8s, using Traefik, I can easily achieve the following functionality: while doing TCP connection reverse proxy, it also checks if the SNI meets the expectations. This situation is suitable for letting the backend of the reverse proxy handle the TLS instead of processing it at Caddy:
apiVersion: traefik.io/v1alpha1
kind: IngressRouteTCP
metadata:
name: sb-cc
namespace: default
spec:
entryPoints:
- webs
routes:
- match: HostSNI(`server.cloudcone.net`)
services:
- name: sb-cc
port: p-0
However, in Caddy, configuring the Caddyfile is not enough to simply achieve this operation. As far as I know, one can only disable auto_https
and then separately configure for each domain, which no doubt increases the complexity of the configuration. Alternatively, one can use JSON for configuration, but the outrageous and extremely complicated JSON format of Caddy makes migrating from Caddyfile to JSON format a great hardship.
Thus, is there any easy and practical method for TCP proxy and SNI checking?