Add CORS support and response caching to aggregate endpoints
- 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:
+7
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user