# ========================================== # /api 의 nginx 오류 응답 — 두 server(포털 · 공개 내려받기)가 넣는다 (nginx.conf). 템플릿이 아니다(/etc/nginx/snippets/api-errors.conf) # # message 는 비운다 (문구는 클라이언트가 code 로 사전에서 찾는다, 레지스트리와 겹치지 않게). # traceId 는 이 nginx 의 요청 ID(로그의 rid=)다. 이름 있는 location 은 server 단계라 화면용 헤더 상속을 끈다 # (접근 로그는 server 단계의 쿼리 없는 main_rid 를 그대로 물려받는다). # return 200 은 본문만 정한다 — error_page 를 = 없이 썼으므로 상태 코드는 원래 값(404·413·429·502·504 등)이 그대로 나간다 (2026-10-27 확인) # ========================================== # nginx 가 닫은 경로 404 — 공개 내려받기 server 의 /api/(공개 API 밖) · 포털의 공개 API(공개 호스트를 따로 둘 때). 없는 경로와 같은 RES_001 location @api_not_found { add_header_inherit off; default_type application/json; add_header Cache-Control "no-store" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Request-Id $request_id always; return 200 '{"success":false,"error":{"code":"RES_001","message":"","traceId":"$request_id"}}'; } # 본문 한도 초과 413 — 첨부 · 업로드 · 대용량 조각 · 공개 내려받기 server 의 /api/(1m) location @api_payload_too_large { add_header_inherit off; default_type application/json; add_header Cache-Control "no-store" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Request-Id $request_id always; return 200 '{"success":false,"error":{"code":"FILE_002","message":"","traceId":"$request_id"}}'; } # 동시 연결 수 초과 429 — 대용량 받기의 limit_conn (11단계 — nginx.conf 의 http 단계 "동시 연결 수"). 백엔드의 요청 수 한도와 같은 REQ_001 location @api_too_many_requests { add_header_inherit off; default_type application/json; add_header Cache-Control "no-store" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Request-Id $request_id always; return 200 '{"success":false,"error":{"code":"REQ_001","message":"","traceId":"$request_id"}}'; } # 백엔드 응답 없음 · 시간 초과 등 5xx location @api_unavailable { add_header_inherit off; default_type application/json; add_header Cache-Control "no-store" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Request-Id $request_id always; return 200 '{"success":false,"error":{"code":"SYS_001","message":"","traceId":"$request_id"}}'; }