fix(config): move root redirect to page and skip slash redirect
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 50s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 14s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 50s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 14s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
- เข้า /docedit เดิมใช้ redirects() (Next เติม basePath ให้ source /) ถอดออกให้ app/page.tsx ที่ root จับ /docedit และ /docedit/ แทน พร้อมส่งต่อ query เอง เพราะ redirect() ของ next/navigation ไม่แนบ searchParams ให้อัตโนมัติ (รักษาสัญญาลิงก์ e-Court /docedit/?fileUrl=&fileId=&typeId= ของ N8) - เพิ่ม skipTrailingSlashRedirect: true ปิด 308 trailing slash อัตโนมัติของ Next กัน ping-pong กับ rewrite rule ของ IIS ตอน deploy หลัง proxy - redirects() ใหม่แบบ basePath:false จับเฉพาะ root ของ host (/ แท้) ส่งตรงไป /docedit/note Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
b41816e2b6
commit
7a146d48be
2 changed files with 40 additions and 3 deletions
|
|
@ -14,10 +14,24 @@ const nextConfig = {
|
|||
basePath,
|
||||
// expose ให้โค้ดใช้ (inline ตอน build) — ค่าจริงประกาศที่เดียวที่ไฟล์นี้
|
||||
env: { NEXT_PUBLIC_BASE_PATH: basePath, NEXT_PUBLIC_APP_PATH: appPath },
|
||||
// เข้า /docedit/ ตรง ๆ (ไม่มี route ที่ root) → โผล่ที่หน้ารายการของ /note
|
||||
// (Next เติม basePath ให้ source/destination เอง + query ส่งต่ออัตโนมัติ — รองรับ /docedit/?fileUrl=…)
|
||||
// ปิด redirect trailing slash อัตโนมัติของ Next (308 /docedit → /docedit/
|
||||
// และ /docedit/note/ → /docedit/note) — deploy หลัง IIS แล้ว redirect พวกนี้
|
||||
// ตีกับ rewrite rule ของ IIS จนกลายเป็น ping-pong loop; ปิดให้หน้า/ไฟล์ทุกอย่าง
|
||||
// serve ได้ทั้งแบบมี/ไม่มี slash ฝั่ง proxy เป็นคนกำหนดเอง
|
||||
skipTrailingSlashRedirect: true,
|
||||
// จับเฉพาะ root ของ host ("/" แท้ ๆ — basePath:false ทำให้ rule นี้ไม่จับ
|
||||
// /docedit) เผื่อ IIS ส่ง path "/" เข้า process: ส่งตรงไป /docedit/note เลย
|
||||
// ส่วน /docedit และ /docedit/ จับที่ app/page.tsx แทน (ส่งต่อ query เอง —
|
||||
// รักษาสัญญาลิงก์ e-Court /docedit/?fileUrl=&fileId=&typeId=)
|
||||
async redirects() {
|
||||
return [{ source: "/", destination: appPath, permanent: false }];
|
||||
return [
|
||||
{
|
||||
source: "/",
|
||||
destination: `${basePath}${appPath}`,
|
||||
basePath: false, // ป้องกัน basePath ซ้อน (destination เขียนเต็มแล้ว)
|
||||
permanent: false,
|
||||
},
|
||||
];
|
||||
},
|
||||
// N4 อัปโหลดไฟล์ผ่าน Server Action — default 1MB ไม่พอสำหรับ PDF/สแกนศาล (ต้องตรงกับ MAX_UPLOAD_BYTES ใน app/actions/files.ts)
|
||||
experimental: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue