]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add Content-Type header to Vault KMS requests 68279/head
authorwuhongsong <wojiaowugen@163.com>
Thu, 9 Apr 2026 10:16:31 +0000 (18:16 +0800)
committerwuhongsong <wojiaowugen@163.com>
Thu, 9 Apr 2026 10:22:25 +0000 (18:22 +0800)
RGW sends JSON POST requests to Vault Transit API without setting the
Content-Type header, causing libcurl to default to
application/x-www-form-urlencoded. While standard HashiCorp Vault
tolerates this, Vault-compatible implementations that use strict HTTP
frameworks reject such requests with 415 Unsupported Media Type.
Add Content-Type: application/json to POST requests in
VaultSecretEngine::send_request(), consistent with all other RGW
modules that send JSON (rgw_keystone.cc, rgw_opa.cc,
rgw_pubsub_push.cc, rgw_sync_module_es.cc).

Signed-off-by: wuhongsong <wojiaowugen@163.com>
src/rgw/rgw_kms.cc

index 9cca90aa3b5caaa3c43b83b025cb9b3ab9519580..e089b4ec25faceff4d8e4d7e61efb2369757935d 100644 (file)
@@ -288,6 +288,7 @@ protected:
     if (postdata.length()) {
       secret_req.set_post_data(postdata);
       secret_req.set_send_length(postdata.length());
+      secret_req.append_header("Content-Type", "application/json");
     }
 
     if (!vault_token.empty()) {