# TLS re-encrypt (TLS termination + TLS origination)
#
# HTTPS on the listener; TLS to the upstream backend.
# The proxy terminates the client TLS session and opens
# a new TLS session to the backend.
#
#   Client -> TLS -> Praxis :8443 -> TLS -> Backend :9443
#
# Usage:
#   mkcert -install && mkcert localhost 127.0.0.1
#   cargo run -p praxis-proxy -- -c examples/configs/protocols/tls-http-reencrypt.yaml
#   curl https://localhost:8443/

listeners:
  - name: secure
    address: "127.0.0.1:8443"
    filter_chains:
      - main
    tls:
      certificates:
        - cert_path: /etc/ssl/certs/server.pem
          key_path: /etc/ssl/private/server-key.pem

filter_chains:
  - name: main
    filters:
      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend

      - filter: load_balancer
        clusters:
          - name: backend
            tls:
              sni: "backend.example.com"
            endpoints:
              - "127.0.0.1:9443"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends
