-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCaddyfile
More file actions
96 lines (81 loc) · 2.59 KB
/
Caddyfile
File metadata and controls
96 lines (81 loc) · 2.59 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
# ALB 같은 프록시에서 온 X-Forwarded-* 헤더 신뢰
servers {
trusted_proxies static 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
}
# ALB가 HTTPS 처리하므로 Caddy는 HTTP만
auto_https off
}
http://promptplace.kro.kr {
encode zstd gzip
# 보안 헤더 (HSTS는 HTTPS 응답에서만 의미 있으므로 여기서는 생략 가능)
header {
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
}
# Socket.IO 요청을 백엔드로 전달
handle /socket.io/* {
reverse_proxy app:3000
}
# api-docs 요청을 앱으로 전달
handle /api-docs* {
reverse_proxy app:3000
}
# /api/* 요청만 app:3000으로 프록시
handle /api/* {
reverse_proxy app:3000 {
# 백엔드 상태 체크용 (Caddy→app)
health_uri /health
health_interval 30s
health_timeout 3s
fail_duration 10s
# ALB에서 받은 원래 요청 스킴/호스트/IP 전달
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Host {host}
header_up X-Real-IP {remote_host}
}
}
# (선택) ALB 헬스체크 편의 엔드포인트
@health path /health
handle @health {
respond "ok" 200
}
# 로그
log {
output stdout
format console
}
}
# 테스트 서버 (Development)
http://promptplace-dev.kro.kr {
encode zstd gzip
header {
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
}
# Socket.IO 요청을 백엔드로 전달
handle /socket.io/* {
reverse_proxy app-dev:3000
}
handle /api/* {
# app-dev 컨테이너(테스트용)로 연결
reverse_proxy app-dev:3000 {
health_uri /health
health_interval 30s
health_timeout 3s
fail_duration 10s
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Host {host}
header_up X-Real-IP {remote_host}
}
}
# 로드밸런서 헬스체크용
@health path /health
handle @health {
respond "ok" 200
}
log {
output stdout
format console
}
}