小调整。
							parent
							
								
									a1e23dba55
								
							
						
					
					
						commit
						68c0ea5d5d
					
				|  | @ -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 | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 王良
						王良