From 6cdfbae5611a4914df5834c71e4cfeb195dc6869 Mon Sep 17 00:00:00 2001 From: Bkk1234 Date: Wed, 25 Nov 2026 03:28:24 +0700 Subject: [PATCH] =?UTF-8?q?docs(deploy):=20audit=20log=20=E0=B8=88?= =?UTF-8?q?=E0=B8=A3=E0=B8=B4=E0=B8=87=20=E2=80=94=20CSS=20hash=20?= =?UTF-8?q?=E0=B9=80=E0=B8=81=E0=B9=88=E0=B8=B2=20404=20+=20/=5Fagent-nati?= =?UTF-8?q?ve=20404=20=E0=B9=81=E0=B8=A5=E0=B8=B0=E0=B8=A7=E0=B8=B4?= =?UTF-8?q?=E0=B8=98=E0=B8=B5=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B9=81=E0=B8=81?= =?UTF-8?q?=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/deploy-dokploy.md | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/deploy-dokploy.md b/docs/deploy-dokploy.md index 8b9240c..745fac0 100644 --- a/docs/deploy-dokploy.md +++ b/docs/deploy-dokploy.md @@ -197,3 +197,59 @@ curl -s "https://alterflixhub.hobbypj.com/sw.js?v=$(date +%s)" | grep -m1 "const - **ห้าม rename container ที่ผูกกับ Traefik/Swarm** — endpoint table พัง ให้ `rm -f` แล้วสร้างใหม่ - container ของแอปนี้ต้องมีชื่อ `alterflixhub-compose-doefaz-web-1` เพราะไฟล์ Traefik อ้างด้วยชื่อ + ต้องอยู่บน `dokploy-network` - Cloudflare cache ทำให้ `/sw.js` ยังเสิร์ฟเวอร์ชันเก่าได้ → ทดสอบด้วย `?v=` เสมอ + +## Audit จาก access log จริง (2026-11-25) — เจอ 2 เคสและแก้แล้ว + +### 1) `GET /assets/global-DjioL_Jq.css` → 404 (หน้าค้างแคชไม่มีสไตล์) + +อาการใน log + +``` +"GET /assets/global-DjioL_Jq.css HTTP/1.1" 404 31038 ... "https://alterflixhub.hobbypj.com/" +``` + +สาเหตุ: หน้าที่ยังค้างในเบราว์เซอร์/SW รุ่นก่อนอ้างชื่อ CSS ที่ hash เก่า ซึ่งไม่มีใน build ใหม่ +ผลคือหน้าเว็บไม่ถูกจัดสไตล์ และไปกระตุ้น `__agent-native-chunk-recovery` ต่อ + +แก้ (ทำแล้ว) + +- `docker/30-origin.sh` คัดลอก `assets/global-.css` → `assets/global.css` ทุกครั้งที่ container สตาร์ท (ไม่ hardcode hash) +- `docker/default.conf.template` + ```nginx + location ~ ^/assets/[^/]+\.css$ { + try_files $uri /assets/global.css; + } + ``` + → request CSS hash ใดก็ได้ ได้ CSS ล่าสุดกลับไป 200 `text/css` + +### 2) `/_agent-native/*` → 404 ทุกครั้งที่เปิดหน้า + +``` +GET /_agent-native/auth/session 404 +GET /_agent-native/agent-engine/status 404 +POST /_agent-native/auth/attribution 404 +GET /about/__agent-native-chunk-recovery 404 +``` + +สาเหตุ: chunk ของ agent-native ที่ติดมากับ build ยังยิง endpoint เหล่านี้ (static export ไม่มี backend) +แก้: nginx ตอบ **204 + access_log off** + +```nginx +location ^~ /_agent-native/ { access_log off; return 204; } +location ~ /__agent-native-chunk-recovery$ { access_log off; return 204; } +``` + +### ผลตรวจหลังแก้ (production) + +| path | ก่อน | หลัง | +|---|---|---| +| `/assets/global-DjioL_Jq.css` (hash เก่า) | 404 | **200 text/css** | +| `/assets/global.css` | 404 | 200 text/css | +| `/_agent-native/auth/session` | 404 31 KB | **204** | +| `/_agent-native/agent-engine/status` | 404 31 KB | **204** | +| `POST /_agent-native/auth/attribution` | 404 | **204** | +| `/about/__agent-native-chunk-recovery` | 404 | **204** | +| `/sw.js` | v2.1.2 | **v2.1.5** | +| `/` | 200 | 200 (การ์ด 270px, ไม่มี CSS 404) | + +หมายเหตุ: ผู้ใช้ที่เปิดแท็บค้างไว้ตั้งแต่ก่อน deploy ยังต้อง **hard reload 1 ครั้ง** (SW v2.1.5 ล้างแคชหน้าเก่าให้)