@mandujs/core 0.20.3 → 0.20.4
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 +11 -0
package/package.json
CHANGED
package/src/runtime/server.ts
CHANGED
|
@@ -1021,6 +1021,10 @@ async function handleRequest(req: Request, router: Router, registry: ServerRegis
|
|
|
1021
1021
|
if (!result.ok) {
|
|
1022
1022
|
const errorResponse = errorToResponse(result.error, registry.settings.isDev);
|
|
1023
1023
|
if (registry.settings.isDev) {
|
|
1024
|
+
// #177: dev 모드 에러 응답도 캐시 방지
|
|
1025
|
+
if (!errorResponse.headers.has("Cache-Control")) {
|
|
1026
|
+
errorResponse.headers.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
1027
|
+
}
|
|
1024
1028
|
const url = new URL(req.url);
|
|
1025
1029
|
const p = url.pathname;
|
|
1026
1030
|
if (!p.startsWith("/.mandu/") && !p.startsWith("/__kitchen")) {
|
|
@@ -1035,6 +1039,13 @@ async function handleRequest(req: Request, router: Router, registry: ServerRegis
|
|
|
1035
1039
|
if (registry.settings.isDev) {
|
|
1036
1040
|
const url = new URL(req.url);
|
|
1037
1041
|
const p = url.pathname;
|
|
1042
|
+
|
|
1043
|
+
// #177: dev 모드에서 SSR HTML 응답에 Cache-Control 헤더 추가
|
|
1044
|
+
// 브라우저가 오래된 HTML을 캐시하여 변경사항이 반영 안 되는 문제 방지
|
|
1045
|
+
if (!result.value.headers.has("Cache-Control")) {
|
|
1046
|
+
result.value.headers.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1038
1049
|
if (!p.startsWith("/.mandu/") && !p.startsWith("/__kitchen")) {
|
|
1039
1050
|
const elapsed = Date.now() - requestStart;
|
|
1040
1051
|
const status = result.value.status;
|