From 4221dad741c3187e1b1ea13f69547d2558f75d87 Mon Sep 17 00:00:00 2001 From: hbyang Date: Mon, 14 Sep 2026 15:56:33 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20nginx:=20=EC=8A=B9=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=97=A4=EB=8D=94=EA=B0=80=20try=5Ffiles?= =?UTF-8?q?=20=EC=97=90=EC=84=9C=20=EC=9C=A0=EC=8B=A4=EB=90=98=EB=8D=98=20?= =?UTF-8?q?=EA=B2=83=20=E2=80=94=20rewrite=20break=20=EB=A1=9C=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20=EB=B8=94=EB=A1=9D=EC=97=90=20=EB=A8=B8=EB=AC=B8?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /approve/ 블록에 Referrer-Policy·no-store·noindex 를 달아 뒀는데 **응답에 하나도 안 붙었다** (실측 2026-09-14: 200 은 뜨는데 헤더만 없다). `try_files` 의 폴백은 내부 리다이렉트라 요청이 이 블록을 떠나 `location /` 로 다시 들어가고, 거기서 나가는 응답에는 이 블록의 add_header 가 적용되지 않는다. 승인 링크의 nonce 가 Referer 로 새고 검색 색인에 남을 수 있는 상태였다. - `rewrite ^ /__spa-fallback.html break` 로 바꿨다. break 는 같은 블록에 머물러 헤더가 붙는다. 승인 링크는 SPA 한 장이라 파일을 찾아 줄 일이 없다 — 곧바로 셸을 준다 - site.conf.example 과 로컬 site.conf 를 같이 고쳤다. ★ 운영 서버의 site.conf 는 gitignore 라 example 을 고쳐도 따라오지 않는다 — 배포 때 이 블록을 손으로 옮겨야 한다 검증: `curl -D -` 로 Referrer-Policy: no-referrer · Cache-Control: no-store · X-Robots-Tag: noindex, nofollow 세 줄 확인. 승인 페이지가 빌더 셸로 뜨는 것도 확인 Co-Authored-By: Claude Opus 5 (1M context) --- nginx/site.conf.example | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nginx/site.conf.example b/nginx/site.conf.example index ab5d9f3..b1d959a 100644 --- a/nginx/site.conf.example +++ b/nginx/site.conf.example @@ -43,14 +43,20 @@ server { application/javascript application/json application/xml image/svg+xml; - # 승인 nonce·OAuth code가 액세스 로그나 Referer로 새지 않도록 별도로 서빙한다. + # 승인 nonce 가 액세스 로그·Referer·검색 색인으로 새지 않게 이 자리만 따로 준다. + # + # ★ `try_files` 를 쓰면 헤더가 사라진다. try_files 의 폴백은 **내부 리다이렉트**라 + # 요청이 이 블록을 떠나 `location /` 로 다시 들어가고, 거기서 나가는 응답에는 + # 아래 add_header 가 하나도 붙지 않는다(실측 2026-09-14: 200 은 뜨는데 헤더만 없다). + # `rewrite ... break` 는 같은 블록 안에 머문다 — 그래서 이 모양이어야 한다. + # ★ 승인 링크는 SPA 한 장이라 파일을 찾아 줄 일이 없다. 곧바로 셸을 준다. location ^~ /approve/ { root /srv/app; - try_files $uri /index.html; access_log off; add_header Referrer-Policy "no-referrer" always; add_header Cache-Control "no-store" always; add_header X-Robots-Tag "noindex, nofollow" always; + rewrite ^ /__spa-fallback.html break; } # ── 발행 사이트 ────────────────────────────────────────────