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>
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()) {