HTTP: Fix 204 CORS preflight responses
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user