From d04cdcf40deb8341026730f1591347fb315832fb Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 29 Oct 2021 12:28:24 -0700 Subject: [PATCH] s3 header add user agent --- weed/storage/backend/s3_backend/s3_sessions.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/storage/backend/s3_backend/s3_sessions.go b/weed/storage/backend/s3_backend/s3_sessions.go index be10ad8e5..3170172d4 100644 --- a/weed/storage/backend/s3_backend/s3_sessions.go +++ b/weed/storage/backend/s3_backend/s3_sessions.go @@ -2,6 +2,8 @@ package s3_backend import ( "fmt" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/chrislusf/seaweedfs/weed/util" "sync" "github.com/aws/aws-sdk-go/aws" @@ -47,6 +49,9 @@ func createSession(awsAccessKeyId, awsSecretAccessKey, region, endpoint string) if err != nil { return nil, fmt.Errorf("create aws session in region %s: %v", region, err) } + sess.Handlers.Build.PushBack(func(r *request.Request) { + r.HTTPRequest.Header.Set("User-Agent", "SeaweedFS/"+util.VERSION_NUMBER) + }) t := s3.New(sess)