Add support for configuring immutable paths
All checks were successful
Build / build (push) Successful in 2m38s
All checks were successful
Build / build (push) Successful in 2m38s
This commit is contained in:
parent
11ed96b683
commit
5fff414805
2 changed files with 16 additions and 0 deletions
14
src/caddy.rs
14
src/caddy.rs
|
@ -83,6 +83,20 @@ impl CaddyController {
|
|||
}));
|
||||
}
|
||||
|
||||
if !config.immutable_paths.is_empty() {
|
||||
routes_array.push(json!({
|
||||
"match": [{ "path": config.immutable_paths }],
|
||||
"handle": [{
|
||||
"handler": "headers",
|
||||
"response": {
|
||||
"set": {
|
||||
"Cache-Control": ["public, max-age=15778476, immutable"]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}))
|
||||
}
|
||||
|
||||
routes_array.push(json!({
|
||||
"handle": [{
|
||||
"handler": "file_server",
|
||||
|
|
|
@ -23,6 +23,8 @@ pub struct SiteConfig {
|
|||
pub paths_mode: SiteConfigPathsMode,
|
||||
#[serde(default)]
|
||||
pub redirects: Vec<SiteConfigRedirect>,
|
||||
#[serde(default)]
|
||||
pub immutable_paths: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Eq, PartialEq)]
|
||||
|
|
Loading…
Add table
Reference in a new issue