My App
Use caseGateway

CORS preflight

Use case Gateway để xử lý browser CORS preflight request.

Use case: CORS preflight

Trạng thái

Đang draft.

Service sở hữu

API Gateway.

Endpoint

OPTIONS /api/*

Yêu cầu xác thực

Public.

Mục tiêu

Cho phép browser client hoàn tất CORS preflight trước khi gửi auth request hoặc business request.

Luồng request

Client -> API Gateway -> Service sở hữu -> Database/internal dependency -> Response

Hành vi token và header

Client gửi:

  • Authorization:
  • Cookie:

Gateway inject:

  • X-Account-Id
  • X-Workspace-Id
  • X-Member-Id
  • X-Active-Branch-Id
  • X-Branch-Ids
  • X-Roles
  • X-Token-Scope
  • X-Request-Id
  • X-Correlation-Id

Contract API

Request

{}

Response thành công

{}

Response lỗi

  • TODO

Hành vi database

Đọc:

  • TODO

Ghi:

  • TODO

Quy tắc quan trọng:

  • Không trust workspaceId từ request body nếu context đã có trong token/header.
  • Dùng Gateway trusted headers cho downstream context.
  • Enforce isolation workspace/member.

Log và observability

Log kỳ vọng:

  • Gateway access log
  • Owner service access log
  • propagation request_id/correlation_id

Tiêu chí nghiệm thu

  • Happy path chạy.
  • Case token không hợp lệ chạy.
  • Case workspace/member bị disabled chạy khi áp dụng.
  • Format lỗi theo convention CenterOS.
  • Log có request_id/correlation_id.
  • Bruno/local smoke test pass.

Bằng chứng test

# TODO

Câu hỏi mở

  • TODO

On this page