feat: add cache-control:no-cache while sending file and index

pull/528/head
sigoden 2025-01-17 20:38:51 +08:00
parent e576ddcbea
commit 7e9e770ffe
1 changed files with 4 additions and 0 deletions

View File

@ -838,6 +838,8 @@ impl Server {
}
}
res.headers_mut()
.typed_insert(CacheControl::new().with_no_cache());
res.headers_mut().typed_insert(last_modified);
res.headers_mut().typed_insert(etag.clone());
@ -958,6 +960,8 @@ impl Server {
.replace("__INDEX_DATA__", &index_data);
res.headers_mut()
.typed_insert(ContentLength(output.as_bytes().len() as u64));
res.headers_mut()
.typed_insert(CacheControl::new().with_no_cache());
if head_only {
return Ok(());
}