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
23
app/page.tsx
Normal file
23
app/page.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { redirect } from "next/navigation";
|
||||
|
||||
// หน้า root (/docedit) — แทน redirects() เดิมใน next.config.mjs (ถอดออกลด hop
|
||||
// ที่ Next สั่งเองตอน deploy หลัง IIS/proxy): พาเข้าหน้ารายการของ /note เสมอ
|
||||
// — redirect() ไม่แนบ searchParams ให้อัตโนมัติเหมือน redirects() จึงต้องส่งต่อ
|
||||
// เอง ไม่งั้นสัญญาลิงก์ e-Court /docedit/?fileUrl=&fileId=&typeId= (N8) พัง
|
||||
// (redirect ของ next/navigation เติม basePath ให้เอง — invariant #12)
|
||||
export default function RootPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Record<string, string | string[] | undefined>;
|
||||
}) {
|
||||
const qs = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(searchParams)) {
|
||||
if (typeof value === "string") {
|
||||
qs.set(key, value);
|
||||
} else if (Array.isArray(value)) {
|
||||
for (const v of value) qs.append(key, v);
|
||||
}
|
||||
}
|
||||
const query = qs.toString();
|
||||
redirect(`/note${query ? `?${query}` : ""}`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue