diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-07-28 08:47:24 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-07-28 08:47:27 -0700 |
| commit | a566bfc6e1b25c262c3eb20cd9a8a2ef7a5f5392 (patch) | |
| tree | 072eaf5032406c75fee19b44e1953bc8655349de /weed/s3api/s3api_server.go | |
| parent | bfa07af326a7ae2a015a7dd1235b1c6b10966d2c (diff) | |
| download | seaweedfs-a566bfc6e1b25c262c3eb20cd9a8a2ef7a5f5392.tar.xz seaweedfs-a566bfc6e1b25c262c3eb20cd9a8a2ef7a5f5392.zip | |
s3: use bucket in the domain
fix https://github.com/chrislusf/seaweedfs/issues/1405
Diffstat (limited to 'weed/s3api/s3api_server.go')
| -rw-r--r-- | weed/s3api/s3api_server.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go index 773094a5f..010958245 100644 --- a/weed/s3api/s3api_server.go +++ b/weed/s3api/s3api_server.go @@ -1,6 +1,7 @@ package s3api import ( + "fmt" "net/http" "github.com/gorilla/mux" @@ -9,6 +10,7 @@ import ( type S3ApiServerOption struct { Filer string + Port int FilerGrpcAddress string Config string DomainName string @@ -37,7 +39,10 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) { apiRouter := router.PathPrefix("/").Subrouter() var routers []*mux.Router if s3a.option.DomainName != "" { - routers = append(routers, apiRouter.Host("{bucket:.+}."+s3a.option.DomainName).Subrouter()) + routers = append(routers, apiRouter.Host( + fmt.Sprintf("%s.%s:%d", "{bucket:.+}", s3a.option.DomainName, s3a.option.Port)).Subrouter()) + routers = append(routers, apiRouter.Host( + fmt.Sprintf("%s.%s", "{bucket:.+}", s3a.option.DomainName)).Subrouter()) } routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter()) |
