Add CORS support and response caching to aggregate endpoints
Publish telemt-api gateway Docker image / test (push) Successful in 25s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m19s

- Introduced CORS configuration options in config.example.yaml, allowing specification of allowed origins for cross-origin requests.
- Enhanced the aggregate handler to support response caching with a configurable TTL, improving performance for repeated requests.
- Updated the aggregate API to return a structured response indicating whether any upstream requests failed, enhancing error handling and response clarity.
- Modified documentation in AGGREGATE.md and README.md to reflect the new CORS and caching features.
- Added tests to validate the new functionality in the aggregate handler.
This commit is contained in:
Denozordec
2026-03-30 10:02:16 +07:00
parent 2a8390e687
commit 04c257a84e
14 changed files with 1071 additions and 142 deletions
+7 -1
View File
@@ -23,11 +23,17 @@ whitelist_cidrs:
# - "10.0.0.0/8"
trusted_proxies: []
# Опционально: по умолчанию /api/agg/* опрашивает все servers; можно ограничить список:
# SPA на другом origin (preflight OPTIONS + Access-Control-Allow-Origin):
# cors_allowed_origins:
# - "http://localhost:5173"
# # - "*"
# Опционально: по умолчанию /api/agg/* опрашивает все servers; можно ограничить список и включить кэш ответов:
# aggregate:
# include_aliases:
# - gt1
# - gt2
# cache_ttl_ms: 2000
# Геолокация IP в /api/agg/unique-ips. См. docs/GEOIP.md (City + опционально ASN; Country-only не нужен)
# geoip: