mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-19 19:16:17 +00:00
fix(s3): implement S3-compliant CORS and bucket existence checks (#2026)
This commit is contained in:
@@ -669,16 +669,13 @@ pub(crate) async fn apply_cors_headers(bucket: &str, method: &http::Method, head
|
||||
return None;
|
||||
}
|
||||
|
||||
// For OPTIONS (preflight) requests, check Access-Control-Request-Method
|
||||
// Use Access-Control-Request-Method if present (for preflight and non-preflight requests),
|
||||
// otherwise fall back to the actual HTTP method.
|
||||
let is_preflight = method == http::Method::OPTIONS;
|
||||
let requested_method = if is_preflight {
|
||||
headers
|
||||
.get(cors::request::ACCESS_CONTROL_REQUEST_METHOD)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or(method_str)
|
||||
} else {
|
||||
method_str
|
||||
};
|
||||
let requested_method = headers
|
||||
.get(cors::request::ACCESS_CONTROL_REQUEST_METHOD)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or(method_str);
|
||||
|
||||
// Get requested headers from preflight request
|
||||
let requested_headers = if is_preflight {
|
||||
|
||||
Reference in New Issue
Block a user