Skip to content

Current State Gateway

plutogr edited this page May 23, 2026 · 2 revisions

Gateway

Обновлено: 2026-05-23

Назначение

Gateway — внешняя точка входа:

  • YARP reverse proxy до внутренних сервисов
  • route-level auth policies
  • cookie-to-bearer адаптация
  • auth request/response transforms
  • rate limiting, CORS, security headers, aggregated health checks

Ключевые маршруты

Сводка вынесена в API-карту.

Техническое поведение

Middleware pipeline

  1. Forwarded headers
  2. Security headers (X-Content-Type-Options, X-Frame-Options, CSP и др.)
  3. Serilog request logging
  4. CorrelationId middleware
  5. Global exception middleware
  6. CORS
  7. Rate limiting
  8. Cookie → Authorization header middleware
  9. Authentication / Authorization
  10. Auth request middleware (refresh/logout body adaptation)
  11. Health endpoints + YARP mapping

Cookie/Auth flow

  • Входящий access_token cookie конвертируется в Authorization: Bearer ....
  • Для refresh и logout при пустом body может быть подставлен refresh token из cookie.
  • Для login/register/refresh ответы трансформируются: выставляются httpOnly cookies.

Health endpoints

Method Route
GET /health/live
GET /health/ready

/health/ready проверяет доступность downstream сервисов по настроенным URL.

Конфигурация

Ключевые секции:

  • ReverseProxy (routes/clusters)
  • JwtSettings
  • Cookie
  • RateLimiting
  • Cors
  • HealthCheckEndpoints
  • Otel

Security

  • Route-level authorization policies из shared contracts
  • JWT validation (issuer/audience/signature/lifetime)
  • Базовые secure headers
  • CORS whitelist
  • Rate limiting

Observability

  • Serilog (structured logs + correlation id)
  • OpenTelemetry tracing (OTLP endpoint configurable)
  • Health checks

Важный интеграционный нюанс

Realtime Chat Hub path требует согласования end-to-end маршрутизации через Gateway и frontend hub URL.

Clone this wiki locally