Make cache duration customizable
This commit is contained in:
parent
cc4f3669c5
commit
201237c3f3
|
@ -4,6 +4,8 @@ use actix_web::HttpRequest;
|
|||
use actix_web::web::resource;
|
||||
use actix_web::Resource;
|
||||
|
||||
const DEFAULT_CACHE: &str = "max-age=86400";
|
||||
|
||||
/// Represents a single static asset
|
||||
///
|
||||
/// Each asset is embeded into the binary, and can be served under the
|
||||
|
@ -32,7 +34,7 @@ impl StaticAsset {
|
|||
let mut response = HttpResponse::Ok();
|
||||
response
|
||||
.header("Etag", env!("CARGO_PKG_VERSION"))
|
||||
.header("Cache-Control", "max-age=86400");
|
||||
.header("Cache-Control", DEFAULT_CACHE);
|
||||
|
||||
let req_etag = req.headers().get("If-None-Match");
|
||||
match req_etag {
|
||||
|
|
Loading…
Reference in a new issue