小调整。

pull/334/head
王良 2024-08-20 17:23:14 +08:00
parent a1e23dba55
commit 68c0ea5d5d
1 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@ module.exports = {
// 只有GET请求且响应码为2xx时才进行缓存 // 只有GET请求且响应码为2xx时才进行缓存
if (rOptions.method !== 'GET' || proxyRes.statusCode < 200 || proxyRes.statusCode >= 300) { if (rOptions.method !== 'GET' || proxyRes.statusCode < 200 || proxyRes.statusCode >= 300) {
// res.setHeader('DS-Cache-Interceptor', `skip: 'method' or 'status' not match`) // res.setHeader('DS-Cache-Response-Interceptor', `skip: 'method' or 'status' not match`)
return return
} }
@ -52,7 +52,7 @@ module.exports = {
maxAge = maxAgeMatch[1] maxAge = maxAgeMatch[1]
} else { } else {
const url = `${rOptions.method}${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${req.url}` const url = `${rOptions.method}${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${req.url}`
res.setHeader('DS-Cache-Interceptor', `skip: ${maxAgeMatch[1]} > ${maxAge}`) res.setHeader('DS-Cache-Response-Interceptor', `skip: ${maxAgeMatch[1]} > ${maxAge}`)
log.info(`cache response intercept: skip: ${maxAgeMatch[1]} > ${maxAge}, url: ${url}`) log.info(`cache response intercept: skip: ${maxAgeMatch[1]} > ${maxAge}, url: ${url}`)
return return
} }