HTTP: Fix 204 CORS preflight responses

This commit is contained in:
Maurus Decimus
2026-04-17 20:26:52 +02:00
parent 95d1268308
commit 06663389a0
2 changed files with 6 additions and 7 deletions

View File

@@ -95,6 +95,7 @@ This version includes **multiple breaking changes**. If you are upgrading from v
- ACME: Fix wrong origin for subdomain updates (#2360)
- Spam filter: Skip invalid messages during training.
- Calendar: Include minutes in localized invite templates (#2828)
- HTTP: Fix `204` CORS preflight responses
## [0.15.5] - 2026-02-14

View File

@@ -211,7 +211,7 @@ impl ParseHttp for Server {
};
}
(_, &Method::OPTIONS) => {
return Ok(JsonProblemResponse(StatusCode::NO_CONTENT).into_http_response());
return Ok(HttpResponse::new(StatusCode::NO_CONTENT));
}
_ => (),
}
@@ -339,7 +339,7 @@ impl ParseHttp for Server {
.map(|resource| resource.into_http_response());
}
(_, &Method::OPTIONS) => {
return Ok(JsonProblemResponse(StatusCode::NO_CONTENT).into_http_response());
return Ok(HttpResponse::new(StatusCode::NO_CONTENT));
}
_ => (),
},
@@ -387,14 +387,14 @@ impl ParseHttp for Server {
return Ok(self.core.oauth.oidc_jwks.clone().into_http_response());
}
(_, &Method::OPTIONS) => {
return Ok(JsonProblemResponse(StatusCode::NO_CONTENT).into_http_response());
return Ok(HttpResponse::new(StatusCode::NO_CONTENT));
}
_ => (),
},
"api" => {
// Allow CORS preflight requests
if req.method() == Method::OPTIONS {
return Ok(JsonProblemResponse(StatusCode::NO_CONTENT).into_http_response());
return Ok(HttpResponse::new(StatusCode::NO_CONTENT));
}
return self.handle_api_request(&mut req, &session).await;
@@ -579,9 +579,7 @@ impl ParseHttp for Server {
return self.handle_contact_form(&session, form, form_data).await;
}
Method::OPTIONS => {
return Ok(
JsonProblemResponse(StatusCode::NO_CONTENT).into_http_response()
);
return Ok(HttpResponse::new(StatusCode::NO_CONTENT));
}
_ => {}
}