diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-13 10:13:31 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-13 10:19:52 +0200 |
commit | d544a0e0e03c9b69b226fb5bba2ce27a7af270ca (patch) | |
tree | 287b4e735756f1bca3e4942a50d5bd62f13e159c | |
parent | 138e13071be37d873344cd03e316c87ff8057ea0 (diff) | |
download | garage-d544a0e0e03c9b69b226fb5bba2ce27a7af270ca.tar.gz garage-d544a0e0e03c9b69b226fb5bba2ce27a7af270ca.zip |
Send CORS headers for all requestsbug/cors
-rw-r--r-- | src/api/s3/api_server.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/api/s3/api_server.rs b/src/api/s3/api_server.rs index ecc417ab..d1d6288c 100644 --- a/src/api/s3/api_server.rs +++ b/src/api/s3/api_server.rs @@ -4,7 +4,7 @@ use async_trait::async_trait; use futures::future::Future; use hyper::header; -use hyper::{Body, Method, Request, Response}; +use hyper::{Body, Request, Response}; use opentelemetry::{trace::SpanRef, KeyValue}; @@ -167,14 +167,7 @@ impl ApiHandler for S3ApiServer { return Err(Error::forbidden("Operation is not allowed for this key.")); } - // Look up what CORS rule might apply to response. - // Requests for methods different than GET, HEAD or POST - // are always preflighted, i.e. the browser should make - // an OPTIONS call before to check it is allowed - let matching_cors_rule = match *req.method() { - Method::GET | Method::HEAD | Method::POST => find_matching_cors_rule(&bucket, &req)?, - _ => None, - }; + let matching_cors_rule = find_matching_cors_rule(&bucket, &req)?; let resp = match endpoint { Endpoint::HeadObject { |