fix: 도메인 배포 설정 (web-inspector.yakenator.io)
- NEXT_PUBLIC_API_URL을 same-origin(빈값)으로 변경 (Nginx 리버스 프록시 사용) - Nginx 설정 추가 (SSE 버퍼링 OFF, API/Frontend 프록시) - Dockerfile, docker-compose.yml 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -72,7 +72,7 @@ services:
|
||||
ports:
|
||||
- "${FRONTEND_PORT:-3011}:3000"
|
||||
environment:
|
||||
- NEXT_PUBLIC_API_URL=http://backend:8000
|
||||
- NEXT_PUBLIC_API_URL=
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
|
||||
@ -17,7 +17,7 @@ COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV NEXT_PUBLIC_API_URL=http://backend:8000
|
||||
ENV NEXT_PUBLIC_API_URL=
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
61
nginx/nginx.conf
Normal file
61
nginx/nginx.conf
Normal file
@ -0,0 +1,61 @@
|
||||
upstream frontend {
|
||||
server frontend:3000;
|
||||
}
|
||||
|
||||
upstream backend {
|
||||
server backend:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name web-inspector.yakenator.io;
|
||||
|
||||
client_max_body_size 10M;
|
||||
|
||||
# API 요청 → Backend
|
||||
location /api/ {
|
||||
proxy_pass http://backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# 타임아웃 (검사 최대 120초)
|
||||
proxy_read_timeout 120s;
|
||||
proxy_send_timeout 120s;
|
||||
}
|
||||
|
||||
# SSE 스트리밍 전용 (버퍼링 OFF)
|
||||
location ~ ^/api/inspections/[^/]+/stream$ {
|
||||
proxy_pass http://backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Connection '';
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 300s;
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
# SSE content type
|
||||
add_header Content-Type text/event-stream;
|
||||
add_header Cache-Control no-cache;
|
||||
add_header X-Accel-Buffering no;
|
||||
}
|
||||
|
||||
# 나머지 → Frontend
|
||||
location / {
|
||||
proxy_pass http://frontend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Next.js HMR WebSocket (개발 시)
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
50
nginx/web-inspector.yakenator.io.conf
Normal file
50
nginx/web-inspector.yakenator.io.conf
Normal file
@ -0,0 +1,50 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name web-inspector.yakenator.io;
|
||||
|
||||
access_log /var/log/nginx/web-inspector.access.log;
|
||||
error_log /var/log/nginx/web-inspector.error.log;
|
||||
|
||||
client_max_body_size 10M;
|
||||
|
||||
# SSE 스트리밍 전용 (버퍼링 OFF, /api/ 보다 먼저 매칭)
|
||||
location ~ ^/api/inspections/[^/]+/stream$ {
|
||||
proxy_pass http://127.0.0.1:8011;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Connection '';
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 300s;
|
||||
chunked_transfer_encoding off;
|
||||
add_header X-Accel-Buffering no;
|
||||
}
|
||||
|
||||
# API 요청 → Backend
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8011;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_read_timeout 120s;
|
||||
proxy_send_timeout 120s;
|
||||
}
|
||||
|
||||
# 나머지 → Frontend
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3011;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user