Files
jaengseung-made/next.config.ts
gahusb 14996a320b fix: 관리자 문서 미리보기 iframe X-Frame-Options 허용
/api/admin/documents/ 경로만 SAMEORIGIN으로 예외 처리하여
관리자 페이지에서 제안서/질문지 iframe 미리보기가 동작하도록 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 00:25:17 +09:00

51 lines
1.6 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
async headers() {
return [
{
source: "/:path*",
headers: [
// 클릭재킹 방지
{ key: "X-Frame-Options", value: "DENY" },
// MIME 스니핑 방지
{ key: "X-Content-Type-Options", value: "nosniff" },
// Referrer 정책
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
// XSS 필터 (레거시 브라우저)
{ key: "X-XSS-Protection", value: "1; mode=block" },
// HTTPS 강제 (Vercel은 자동 HTTPS이므로 안전)
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
// 권한 정책
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=()",
},
],
},
// 관리자 문서 API: iframe 미리보기 허용 (동일 출처만)
{
source: "/api/admin/documents/:path*",
headers: [
{ key: "Cache-Control", value: "no-store, max-age=0" },
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
],
},
// API 엔드포인트: 캐시 금지 + CORS 차단
{
source: "/api/:path*",
headers: [
{ key: "Cache-Control", value: "no-store, max-age=0" },
// 동일 출처 요청만 허용 (외부 도메인 API 직접 호출 차단)
{ key: "X-Frame-Options", value: "DENY" },
],
},
];
},
};
export default nextConfig;