Examples
Policy Query Credential
Authenticates requests whose API key arrives in the query string, as WebSocket and SSE clients that cannot set headers send it
Category: Setup-dependent integration
Task: Authenticates requests whose API key arrives in the query string, as WebSocket and SSE clients that cannot set headers send it
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.
# Query-parameter API key authentication
#
# Authenticates requests whose API key arrives in the query string, as
# WebSocket and SSE clients that cannot set headers send it. The `policy`
# filter loads a policy whose `identity/api-key` resolver reads
# `?api_key=<key>`; a missing, unknown or repeated key is rejected with
# HTTP 401.
#
# The filter does not rewrite the URL, so the key reaches the upstream, and
# access logs, CDN logs and browser history can record it. Prefer a header
# credential where the client can send one. A policy that reads a query
# credential cannot also delegate. Keep `policy` ahead of `path_rewrite`,
# `url_rewrite` and header-rewriting filters so it authorizes the request
# the client sent.
#
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains:
- main
filter_chains:
- name: main
filters:
# `config_path` points at the policy document. Its resolver declares
# `credential: { kind: query_param, name: api_key }` and the
# `read_query` capability the query credential needs.
- filter: policy
config_path: /etc/praxis/query-credential-policy.yaml
- filter: router
routes:
- path_prefix: "/"
cluster: backend
- filter: load_balancer
clusters:
- name: backend
endpoints:
- "127.0.0.1:3000"
insecure_options:
allow_private_endpoints: true # example proxies to local backends