-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.ts
More file actions
71 lines (68 loc) · 1.83 KB
/
next.config.ts
File metadata and controls
71 lines (68 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
reactCompiler: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
{
protocol: 'http',
hostname: '**',
},
],
},
// next.js 공식문서 참조.
async headers() {
return [
{
// 모든 페이지에 적용되는 보안 헤더
/*
1. X-Content-Type-Options: MIME 스니핑 방지
2. X-Frame-Options: 클릭재킹 공격 방지
3. Referrer-Policy: 리퍼러 정보 제어
*/
source: '/(.*)',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
],
},
{
// Service Worker 파일에 대한 특별 설정
/*
1. Content-Type: 올바른 MIME 타입 설정, 서비스 워커가 자바스크립트로 인식되도록 함
2. Cache-Control: 절대 캐싱하지 않도록 설정, 서비스 워커의 최신 버전이 즉시 반영되도록 함
3. Content-Security-Policy: 스크립트 출처를 자기 자신으로 제한
*/
source: '/sw.js',
headers: [
{
key: 'Content-Type',
value: 'application/javascript; charset=utf-8',
},
{
key: 'Cache-Control',
value: 'no-cache, no-store, must-revalidate',
},
{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self'",
},
],
},
];
},
};
export default nextConfig;