@mandujs/core 0.20.3 → 0.20.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime/server.ts +17 -2
package/package.json
CHANGED
package/src/runtime/server.ts
CHANGED
|
@@ -830,14 +830,18 @@ async function serveStaticFile(pathname: string, settings: ServerRegistrySetting
|
|
|
830
830
|
relativePath = pathname.slice("/public/".length);
|
|
831
831
|
allowedBaseDir = path.join(settings.rootDir, settings.publicDir);
|
|
832
832
|
}
|
|
833
|
-
// 3.
|
|
833
|
+
// 3. .well-known/ 디렉토리 (#178: RFC 8615 표준 — Chrome DevTools, ACME, etc.)
|
|
834
|
+
else if (pathname.startsWith("/.well-known/")) {
|
|
835
|
+
relativePath = pathname.slice(1); // ".well-known/..."
|
|
836
|
+
allowedBaseDir = path.join(settings.rootDir, settings.publicDir);
|
|
837
|
+
}
|
|
838
|
+
// 4. Public 폴더의 루트 파일 (favicon.ico, robots.txt 등)
|
|
834
839
|
else if (
|
|
835
840
|
pathname === "/favicon.ico" ||
|
|
836
841
|
pathname === "/robots.txt" ||
|
|
837
842
|
pathname === "/sitemap.xml" ||
|
|
838
843
|
pathname === "/manifest.json"
|
|
839
844
|
) {
|
|
840
|
-
// 고정된 파일명만 허용 (이미 위에서 정확히 매칭됨)
|
|
841
845
|
relativePath = path.basename(pathname);
|
|
842
846
|
allowedBaseDir = path.join(settings.rootDir, settings.publicDir);
|
|
843
847
|
} else {
|
|
@@ -1021,6 +1025,10 @@ async function handleRequest(req: Request, router: Router, registry: ServerRegis
|
|
|
1021
1025
|
if (!result.ok) {
|
|
1022
1026
|
const errorResponse = errorToResponse(result.error, registry.settings.isDev);
|
|
1023
1027
|
if (registry.settings.isDev) {
|
|
1028
|
+
// #177: dev 모드 에러 응답도 캐시 방지
|
|
1029
|
+
if (!errorResponse.headers.has("Cache-Control")) {
|
|
1030
|
+
errorResponse.headers.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
1031
|
+
}
|
|
1024
1032
|
const url = new URL(req.url);
|
|
1025
1033
|
const p = url.pathname;
|
|
1026
1034
|
if (!p.startsWith("/.mandu/") && !p.startsWith("/__kitchen")) {
|
|
@@ -1035,6 +1043,13 @@ async function handleRequest(req: Request, router: Router, registry: ServerRegis
|
|
|
1035
1043
|
if (registry.settings.isDev) {
|
|
1036
1044
|
const url = new URL(req.url);
|
|
1037
1045
|
const p = url.pathname;
|
|
1046
|
+
|
|
1047
|
+
// #177: dev 모드에서 SSR HTML 응답에 Cache-Control 헤더 추가
|
|
1048
|
+
// 브라우저가 오래된 HTML을 캐시하여 변경사항이 반영 안 되는 문제 방지
|
|
1049
|
+
if (!result.value.headers.has("Cache-Control")) {
|
|
1050
|
+
result.value.headers.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1038
1053
|
if (!p.startsWith("/.mandu/") && !p.startsWith("/__kitchen")) {
|
|
1039
1054
|
const elapsed = Date.now() - requestStart;
|
|
1040
1055
|
const status = result.value.status;
|