feat: CSP 다음/카카오 도메인 허용 + 입고 성적서 파일 백엔드 연동 + 팝업 이미지 중앙정렬

- middleware CSP: *.kakao.com, *.kakaocdn.net 추가 (다음 주소찾기 차단 해결)
- frame-src에 'self' 추가
- 공지 팝업 이미지 중앙정렬 ([&_img]:mx-auto)
- HR 사원관리, 결재, 품목, 생산 등 다수 개선
- API 에러 핸들링 및 JSON 파싱 안정화
This commit is contained in:
유병철
2026-03-11 22:32:58 +09:00
parent e9ac2470e1
commit ea6ca335f1
24 changed files with 625 additions and 139 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
import { authenticatedFetch } from '@/lib/api/authenticated-fetch';
import { stripJsonTrailingData } from '@/lib/api/safe-json-parse';
/**
* 🔵 Catch-All API Proxy (HttpOnly Cookie Pattern)
@@ -190,7 +191,7 @@ async function proxyRequest(
},
});
} else {
const responseData = await backendResponse.text();
let responseData = await backendResponse.text();
// 백엔드가 HTML 에러 페이지를 반환한 경우 (404/500 등)
// HTML을 그대로 전달하면 클라이언트 response.json()에서 SyntaxError 발생
@@ -208,6 +209,10 @@ async function proxyRequest(
{ status }
);
} else {
// PHP trailing output 제거 (JSON 뒤에 warning/error 텍스트가 붙는 경우)
if (responseContentType.includes('application/json') || responseData.trimStart().startsWith('{') || responseData.trimStart().startsWith('[')) {
responseData = stripJsonTrailingData(responseData);
}
clientResponse = new NextResponse(responseData, {
status: backendResponse.status,
headers: {