]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Look at correct header about headers for CORS
authorRobin H. Johnson <robbat2@gentoo.org>
Sun, 15 Dec 2013 19:27:49 +0000 (11:27 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 28 Jan 2014 20:36:31 +0000 (12:36 -0800)
The CORS standard dictates that preflight requests are made with the
Access-Control-Request-Headers header containing the headers of the
author request. The Access-Control-Allow-Headers header is sent in the
response.

The present code looks for Access-Control-Allow-Headers in request, so
fix it to look at Access-Control-Request-Headers instead.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 2abacd9678ae04cefac457882ba718a454948915)

src/rgw/rgw_op.cc

index 76eb6202af9a7124b13d5ff94708623623c2671b..72ff5214f435ca0772a8eba6f9aa8e12cd19eee3 100644 (file)
@@ -520,7 +520,7 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
     return false;
   }
 
-  const char *req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_ALLOW_HEADERS");
+  const char *req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_REQUEST_HEADERS");
 
   get_cors_response_headers(rule, req_hdrs, headers, exp_headers, max_age);
 
@@ -2079,7 +2079,7 @@ void RGWOptionsCORS::execute()
     ret = -ENOENT;
     return;
   }
-  req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_ALLOW_HEADERS");
+  req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_REQUEST_HEADERS");
   ret = validate_cors_request(&bucket_cors);
   if (!rule) {
     origin = req_meth = NULL;