ci(itms): Stage B nginx — /oauth(:11000)+업무REST(:11010) Authorization 헤더 분기
모바일(Bearer JWT)→api·브라우저(세션)→front 공존. front/api 동일 prefix 충돌을 $http_authorization map 으로 해소. 모바일은 루트 업무 prefix 사용(Config.ts 권위). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
4fae61105c
commit
feffb37021
@ -1,13 +1,25 @@
|
||||
# itms.zioinfo.co.kr — ITMS 리버스 프록시 (적용 대기 템플릿)
|
||||
# 개발서버 도메인: itms.zioinfo.co.kr → 서버(101.79.17.164, 내부 10.0.1.6)
|
||||
# itms.zioinfo.co.kr — ITMS 리버스 프록시 (개발서버, Stage B 라이브 반영)
|
||||
# 서버(101.79.17.164). 브라우저 진입점 = front(:11020).
|
||||
#
|
||||
# 선결(라이브 조건):
|
||||
# 1) Tier2 앱 기동: front(11020) 필수, 필요 시 auth(11000)/api(11010) — 런타임 DB·JDK17·기관 프로파일 확보 환경에서
|
||||
# 2) TLS 인증서 발급(itms.zioinfo.co.kr) — 예: certbot --nginx -d itms.zioinfo.co.kr
|
||||
# ※ 앱 미기동 상태에서 적용하면 502. 인증서 미발급 시 443 블록의 ssl_certificate 경로부터 맞출 것.
|
||||
# 구성 (Stage B — 웹 + 모바일 동시 지원):
|
||||
# - front(:11020) : 브라우저 JSP 화면 (세션 기반). 기본 경로.
|
||||
# - auth(:11000) : OAuth2 인가서버. 모바일 password/refresh grant → /oauth/.
|
||||
# - api(:11010) : 업무 REST(Bearer JWT). 모바일 앱이 도메인 경유 직접 호출.
|
||||
#
|
||||
# 진입점: front(:11020) 가 브라우저 진입점. front 가 auth/api 를 서버측 REST(Unirest)로 경유하므로
|
||||
# 일반적으로 front 만 프록시하면 됨. (OAuth 리다이렉트가 브라우저를 auth 로 보내는 구성이면 /oauth 블록 활성화)
|
||||
# ★경로 충돌 해소(실측): front 와 api 가 동일 prefix(/main·/srm·/rem·/sys·/potl 등)를
|
||||
# 각각 화면(11020)·REST(11010)로 제공한다. 순수 경로 분기 불가 → **Authorization: Bearer
|
||||
# 헤더**로 분기($itms_biz_backend map). 모바일은 항상 Bearer 전송(→api), 브라우저는 세션
|
||||
# 쿠키(무 Bearer→front). 이로써 웹/모바일이 한 도메인에서 공존.
|
||||
# ※ 모바일 앱(workspace/itms/mobile)은 '/api/' prefix 가 아니라 **루트 업무 prefix**
|
||||
# (/oauth·/main·/srm·/rem·/bbs·/cmm·/sta·/sys·/potl)를 사용한다(constants/Config.ts 권위).
|
||||
#
|
||||
# 선결: front/auth/api 기동 + certbot(--nginx -d itms.zioinfo.co.kr). 미기동 시 502.
|
||||
|
||||
# 모바일(Bearer JWT)=api(:11010) / 브라우저(세션)=front(:11020) 헤더 기반 분기
|
||||
map $http_authorization $itms_biz_backend {
|
||||
default http://127.0.0.1:11020;
|
||||
"~*^Bearer " http://127.0.0.1:11010;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
@ -19,7 +31,7 @@ server {
|
||||
listen 443 ssl;
|
||||
server_name itms.zioinfo.co.kr;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/itms.zioinfo.co.kr/fullchain.pem; # 발급 후 실제 경로로
|
||||
ssl_certificate /etc/letsencrypt/live/itms.zioinfo.co.kr/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/itms.zioinfo.co.kr/privkey.pem;
|
||||
|
||||
client_max_body_size 50m;
|
||||
@ -30,7 +42,27 @@ server {
|
||||
default_type text/html;
|
||||
}
|
||||
|
||||
# 웹 UI (front :11020) — 브라우저 진입점
|
||||
# OAuth2 인가서버(:11000) — 모바일 password/refresh grant
|
||||
location /oauth/ {
|
||||
proxy_pass http://127.0.0.1:11000;
|
||||
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;
|
||||
}
|
||||
|
||||
# 업무 REST(:11010, Bearer) vs 프론트 화면(:11020, 세션) — Authorization 헤더로 분기
|
||||
location ~ ^/(main|srm|rem|bbs|cmm|sta|sys|potl)/ {
|
||||
proxy_pass $itms_biz_backend$request_uri;
|
||||
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;
|
||||
}
|
||||
|
||||
# 웹 UI (front :11020) — 브라우저 진입점(기본)
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:11020;
|
||||
proxy_set_header Host $host;
|
||||
@ -39,15 +71,4 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
|
||||
# (선택) OAuth 인가서버 직접 노출이 필요한 구성일 때만 활성화
|
||||
# location /oauth/ {
|
||||
# proxy_pass http://127.0.0.1:11000;
|
||||
# proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
# (선택) API 직접 노출 — front 가 서버측 경유하면 불필요
|
||||
# location /api/ {
|
||||
# proxy_pass http://127.0.0.1:11010;
|
||||
# proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user