eCourt-note/app/api/note/files
Your Name 83a2cc3e5e
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 4s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m10s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s
fix(note): use relative redirect Location behind proxy
หลัง reverse proxy ที่เขียนทับ Host เป็น upstream (nginx default
\$proxy_host เช่น 0.0.0.0:3000) การ 302 ด้วย NextResponse.redirect(
new URL(path, request.url)) ประกอบ absolute URL จาก origin ฝั่ง server
ทำให้บน prod กดลิงก์เปิดเอกสารตัวอย่างแล้ว browser ถูกพาไป
https://0.0.0.0:3000/docedit/note/annotate/... แทนโฮสต์จริง

เปลี่ยนเป็น Location แบบ relative (NextResponse + header เอง) ให้
browser resolve เทียบ origin ที่ตัวเองยิงมา — ถูกเสมอไม่ว่า proxy
จะตั้ง header แบบไหน:

- GET /api/note/files/open: 302 เข้า viewer และ 302 หน้าแรก
  กรณี fileError
- GET /api/note/auth/dev-link: 302 เข้า /note?fileUrl=…&t=…

ไม่แตะ dev-link POST ที่คืน {url} เต็ม — dev-only และลิงก์ต้อง
absolute เพื่อคัดลอกไปเปิดที่อื่น

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-02 11:12:11 +07:00
..
[id]/bootstrap feat(sso): switch note session from cookies to token 2026-10-30 18:05:36 +07:00
open fix(note): use relative redirect Location behind proxy 2026-11-02 11:12:11 +07:00