Skip to content

Commit

Permalink
Do no make security headers layer function fallible
Browse files Browse the repository at this point in the history
  • Loading branch information
matze committed Jan 15, 2025
1 parent 94ab1d9 commit 15a4e11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl FromRef<AppState> for Key {
async fn security_headers_layer(
req: axum::extract::Request,
next: axum::middleware::Next,
) -> Result<axum::response::Response, axum::http::StatusCode> {
) -> axum::response::Response {
const SECURITY_HEADERS: [(HeaderName, HeaderValue); 7] = [
(SERVER, HeaderValue::from_static(PACKAGE_NAME)),
(CONTENT_SECURITY_POLICY, HeaderValue::from_static("default-src 'none'; script-src 'self'; img-src 'self' data: ; style-src 'self' data: ; font-src 'self' data: ; object-src 'none' ; base-uri 'none' ; frame-ancestors 'none' ; form-action 'self' ;")),
Expand All @@ -72,7 +72,7 @@ async fn security_headers_layer(
headers.insert(key, value);
}

Ok(response)
response
}

pub(crate) fn make_app(max_body_size: usize, timeout: Duration) -> Router<AppState> {
Expand Down

0 comments on commit 15a4e11

Please sign in to comment.