Avoid caching failed scan snapshots

This commit is contained in:
2569718930@qq.com
2026-06-09 22:47:23 +08:00
parent bd88f717fb
commit 3a1b2dfd6d
5 changed files with 54 additions and 9 deletions
+9 -1
View File
@@ -1,6 +1,9 @@
import { NextRequest, NextResponse } from "next/server";
import { proxyBackendJsonGet } from "@/lib/api-proxy";
import { buildForceRefreshProxyCachePolicy } from "@/lib/proxy-cache-policy";
import {
buildForceRefreshProxyCachePolicy,
buildScanTerminalResponseCacheControl,
} from "@/lib/proxy-cache-policy";
import { DASHBOARD_REFRESH_POLICY_SEC } from "@/lib/refresh-policy";
import {
createProxyTimer,
@@ -64,6 +67,11 @@ export async function GET(req: NextRequest) {
try {
return await proxyBackendJsonGet(req, {
cacheControl: cachePolicy.responseCacheControl,
cacheControlForData: (data) =>
buildScanTerminalResponseCacheControl(
data,
cachePolicy.responseCacheControl,
),
fetchCache:
cachePolicy.fetchMode === "no-store" ? "no-store" : undefined,
publicMessage: "Failed to fetch scan terminal data",