Examples
Credential Injection Env Vars
Injects per-service API credentials read from environment variables, so no secret is written into the config
Category: Setup-dependent integration
Task: Injects per-service API credentials read from environment variables, so no secret is written into the config
Prerequisites: The external service, credentials, or certificates referenced by this configuration.
Run it: Use ghcr.io/praxis-proxy/praxis:0.8.0 and follow the first reverse-proxy tutorial to mount and start the configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
# Credential Injection from Environment Variables
#
# Injects per-service API credentials read from environment
# variables, so no secret is written into the config. One listener
# fronts several services: a path prefix picks the service, the
# prefix is stripped before forwarding, and the upstream gets that
# service's credential and Host header. Client-provided values for
# the credential header are overwritten.
#
# The variables are read once, when the filter is built, from the
# proxy's own environment. If any of them is unset the proxy refuses
# to start (`praxis -t` reports which one), and rotating a credential
# means restarting the proxy with the new value.
#
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains:
- main
filter_chains:
- name: main
filters:
- filter: router
routes:
- path_prefix: "/github"
cluster: github
- path_prefix: "/openai"
cluster: openai
- path_prefix: "/internal"
cluster: internal
# The conditions are mutually exclusive, so only one rewrite
# fires per request; allow_rewrite_override tells pipeline
# validation that the extra rewrite filters are intended.
- filter: path_rewrite
strip_prefix: "/github"
conditions:
- when:
path_prefix: "/github"
- filter: path_rewrite
strip_prefix: "/openai"
allow_rewrite_override: true
conditions:
- when:
path_prefix: "/openai"
- filter: path_rewrite
strip_prefix: "/internal"
allow_rewrite_override: true
conditions:
- when:
path_prefix: "/internal"
- filter: credential_injection
clusters:
- name: github
header: Authorization
env_var: GITHUB_TOKEN
header_prefix: "Bearer "
- name: openai
header: Authorization
env_var: OPENAI_API_KEY
header_prefix: "Bearer "
- name: internal
header: x-api-key
env_var: INTERNAL_API_KEY
- filter: load_balancer
clusters:
- name: github
endpoints:
- "127.0.0.1:3001"
http:
authority: "api.github.com"
- name: openai
endpoints:
- "127.0.0.1:3002"
http:
authority: "api.openai.com"
- name: internal
endpoints:
- "127.0.0.1:3003"
http:
authority: "internal.example.com"
insecure_options:
allow_private_endpoints: true # example proxies to local backends