mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-09-24 10:31:17 +00:00
Add config option to set the HTTP redirect code for external icons
The default code is 307 (temporary) to make it easier to test different icon services, but once a service has been decided on, users should ideally switch to using permanent redirects for cacheability.
This commit is contained in:
parent
920371929b
commit
b7eedbcddc
3 changed files with 28 additions and 3 deletions
|
@ -71,7 +71,14 @@ fn icon_redirect(domain: &str, template: &str) -> Option<Redirect> {
|
|||
}
|
||||
|
||||
let url = template.replace("{}", domain);
|
||||
Some(Redirect::temporary(url))
|
||||
match CONFIG.icon_redirect_code() {
|
||||
308 => Some(Redirect::permanent(url)),
|
||||
307 => Some(Redirect::temporary(url)),
|
||||
_ => {
|
||||
error!("Unexpected redirect code {}", CONFIG.icon_redirect_code());
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/<domain>/icon.png")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue