My App
ServiceAPI Gateway

Tổng quan API Gateway

Vai trò hiện tại của Go API Gateway trong runtime CenterOS.

Tổng quan API Gateway

Trạng thái

Go API Gateway là runtime hiện tại của CenterOS.

  • Repo/folder: api-gateway
  • Container: centeros-api-gateway
  • Image: dorrissdang/centeros-api-gateway:main
  • Host/container port: 8080:8080
  • Đã đóng cho local compose auth/select-branch.

Java Gateway là legacy/đã xóa, không document như runtime hiện tại.

Gateway làm gì

  • Nhận backend traffic từ frontend.
  • Route auth calls tới Identity Service.
  • Route protected business APIs tới downstream services.
  • Validate client JWT bằng Identity JWKS.
  • Guard route family ở mức coarse context: account, branch/platform, system.
  • Xóa context headers do client tự gửi.
  • Inject trusted headers từ verified token claims.
  • Normalize và propagate X-Request-Id, X-Correlation-Id.
  • Ghi structured access logs theo request.
  • Xử lý CORS preflight OPTIONS local tại Gateway.

Gateway không làm gì

  • Không login user.
  • Không issue JWT.
  • Không sở hữu account, credential, session.
  • Không resolve permission/capability chi tiết.
  • Không own setup/billing business behavior.
  • Không query business DB.
  • Không verify lại token thay downstream theo từng domain permission.

Runtime đóng hiện tại

Validated qua Gateway:

Hành viTrạng thái
GET /healthzĐã đóng
POST /api/auth/loginĐã đóng
POST /api/auth/refreshĐã đóng
POST /api/auth/select-branchĐã đóng
CORS OPTIONS trả 204Đã đóng
GET /api/workspaces/current-context route tới Entitlement ServiceReachable, Entitlement chưa đóng

Liên quan

TODO

  • Chưa đóng: Entitlement Service E2E qua Gateway.
  • Chưa đóng: retry/circuit breaker behavior trong runtime docs.

On this page