diff --git a/plugins/out_s3/s3.c b/plugins/out_s3/s3.c index 3b1edafbdab..3c919c3bc04 100644 --- a/plugins/out_s3/s3.c +++ b/plugins/out_s3/s3.c @@ -141,7 +141,7 @@ int create_headers(struct flb_s3 *ctx, char *body_md5, if (ctx->content_type != NULL) { headers_len++; } - if (ctx->compression == FLB_AWS_COMPRESS_GZIP) { + if (ctx->compression == FLB_AWS_COMPRESS_GZIP && ctx->enable_content_encoding_header) { headers_len++; } if (ctx->canned_acl != NULL) { @@ -171,7 +171,7 @@ int create_headers(struct flb_s3 *ctx, char *body_md5, s3_headers[n].val_len = strlen(ctx->content_type); n++; } - if (ctx->compression == FLB_AWS_COMPRESS_GZIP) { + if (ctx->compression == FLB_AWS_COMPRESS_GZIP && ctx->enable_content_encoding_header) { s3_headers[n] = content_encoding_header; n++; } @@ -2376,6 +2376,11 @@ static struct flb_config_map config_map[] = { "Defaults to no compression. " "If 'gzip' is selected, the Content-Encoding HTTP Header will be set to 'gzip'." }, + { + FLB_CONFIG_MAP_BOOL, "enable_content_encoding_header", "true", + 0, FLB_TRUE, offsetof(struct flb_s3, enable_content_encoding_header), + "Set to false to disable the Content-Encoding: gzip header." + }, { FLB_CONFIG_MAP_STR, "content_type", NULL, 0, FLB_FALSE, 0, diff --git a/plugins/out_s3/s3.h b/plugins/out_s3/s3.h index e51d39f2419..a6235e2aa97 100644 --- a/plugins/out_s3/s3.h +++ b/plugins/out_s3/s3.h @@ -119,6 +119,7 @@ struct flb_s3 { int send_content_md5; int static_file_path; int compression; + int enable_content_encoding_header; int port; int insecure; size_t store_dir_limit_size;