Cors
Spec-compliant CORS filter with preflight handling, origin validation, and credential support
Category: Setup-dependent integration
Task: Spec-compliant CORS filter with preflight handling, origin validation, and credential support
Prerequisites: The external service, credentials, or certificates referenced by this configuration.
Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 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.
# CORS (Cross-Origin Resource Sharing)
#
# Spec-compliant CORS filter with preflight handling,
# origin validation, and credential support.
#
# The CORS filter must run before filters that reject
# requests (e.g. ip_acl, guardrails) so that preflight
# OPTIONS are handled before those filters block them.
#
# allow_credentials enables Access-Control-Allow-Credentials: true.
# Per the Fetch spec, credentials require explicit origins (not
# wildcards) for allow_origins, allow_methods, and allow_headers.
#
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains:
- main
filter_chains:
- name: main
filters:
- filter: cors
allow_origins:
- "https://app.example.com"
- "https://*.example.com"
allow_methods:
- GET
- POST
- PUT
- DELETE
allow_headers:
- Content-Type
- Authorization
- X-Request-ID
expose_headers:
- X-Request-ID
- X-RateLimit-Remaining
max_age: 3600
allow_credentials: true
- 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