2026-01-26 11:58:04 -05:00

172 lines
3.5 KiB
YAML

# ====================================
# Nexus API Routes (Rust Backend)
# ====================================
# Static files - public, no auth (logo for emails, etc.)
- id: "nexus:static:public"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/static/<**>"
methods:
- GET
- HEAD
authenticators:
- handler: noop
authorizer:
handler: allow
mutators:
- handler: noop
# Health endpoint - public, no auth
- id: "nexus:health:public"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/health"
methods:
- GET
authenticators:
- handler: noop
authorizer:
handler: allow
mutators:
- handler: noop
# GraphQL endpoint - CORS preflight (must come before authenticated rule)
- id: "nexus:graphql:preflight"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/graphql"
methods:
- OPTIONS
authenticators:
- handler: noop
authorizer:
handler: allow
mutators:
- handler: noop
# GraphQL endpoint - authenticated
- id: "nexus:graphql:authenticated"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/graphql"
methods:
- GET
- POST
authenticators:
- handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: header
# GraphQL Playground - authenticated (same as graphql)
- id: "nexus:graphql:playground"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/graphql/playground"
methods:
- GET
authenticators:
- handler: cookie_session
- handler: anonymous
authorizer:
handler: allow
mutators:
- handler: noop
# Media endpoint - authenticated (session photos/videos)
- id: "nexus:media:authenticated"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "https://api.example.com/api/media/<**>"
methods:
- GET
- HEAD
- OPTIONS
authenticators:
- handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: header
errors:
- handler: json
# ====================================
# Local Development Routes (port 7200)
# ====================================
# Health endpoint - localhost
- id: "nexus:health:localhost"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "http://localhost:7200/health"
methods:
- GET
authenticators:
- handler: noop
authorizer:
handler: allow
mutators:
- handler: noop
# GraphQL endpoint - localhost
- id: "nexus:graphql:localhost"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "http://localhost:7200/graphql"
methods:
- GET
- POST
- OPTIONS
authenticators:
- handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: header
# Media endpoint - localhost
- id: "nexus:media:localhost"
version: "v0.40.0"
upstream:
url: "http://127.0.0.1:5050"
preserve_host: false
match:
url: "http://localhost:7200/api/media/<**>"
methods:
- GET
- HEAD
- OPTIONS
authenticators:
- handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: header