Add improvements 2

This commit is contained in:
Urtzi Alfaro
2026-01-12 22:15:11 +01:00
parent 230bbe6a19
commit b931a5c45e
40 changed files with 1820 additions and 887 deletions

View File

@@ -352,6 +352,25 @@ headers = {
- **Caching**: Gateway caches validated service tokens for 5 minutes
- **No Additional HTTP Calls**: Service auth happens locally at gateway
### Unified Header Management System
The gateway uses a **centralized HeaderManager** for consistent header handling across all middleware and proxy layers.
**Key Features:**
- Standardized header names and conventions
- Automatic header sanitization to prevent spoofing
- Unified header injection and forwarding
- Cross-middleware header access via `request.state.injected_headers`
- Consistent logging and error handling
**Standard Headers:**
- `x-user-id`, `x-user-email`, `x-user-role`, `x-user-type`
- `x-service-name`, `x-tenant-id`
- `x-subscription-tier`, `x-subscription-status`
- `x-is-demo`, `x-demo-session-id`, `x-demo-account-type`
- `x-tenant-access-type`, `x-can-view-children`, `x-parent-tenant-id`
- `x-forwarded-by`, `x-request-id`
### Context Header Injection
When a service token is validated, the gateway injects these headers for downstream services: