# Upstream mTLS (Proxy Presents Client Certificate)
#
# Plain HTTP from clients; the proxy presents a client
# certificate to the upstream backend, which requires
# mutual TLS authentication.
#
#   Client -> HTTP -> Praxis :8080 -> mTLS -> Backend :9443
#
# Usage:
#   cargo run -p praxis-proxy -- -c examples/configs/protocols/tls-mtls-upstream.yaml
#   curl http://localhost:8080/

insecure_options:
  allow_private_endpoints: true # example proxies to local backends
  allow_tls_no_verify: true

listeners:
  - name: plain
    address: "127.0.0.1:8080"
    filter_chains:
      - main

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

      - filter: load_balancer
        clusters:
          - name: backend
            tls:
              verify: false # dev only
              client_cert:
                cert_path: /etc/ssl/certs/proxy-client.pem
                key_path: /etc/ssl/private/proxy-client-key.pem
            endpoints:
              - "127.0.0.1:9443"
