mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
multiplate DomainNames through comma
This commit is contained in:
parent
81cf8d04df
commit
05b5f12f2e
|
@ -3,6 +3,7 @@ package s3api
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -39,10 +40,13 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||||
apiRouter := router.PathPrefix("/").Subrouter()
|
apiRouter := router.PathPrefix("/").Subrouter()
|
||||||
var routers []*mux.Router
|
var routers []*mux.Router
|
||||||
if s3a.option.DomainName != "" {
|
if s3a.option.DomainName != "" {
|
||||||
|
domainNames := strings.Split(s3a.option.DomainName, ",")
|
||||||
|
for _, domainName := range domainNames {
|
||||||
routers = append(routers, apiRouter.Host(
|
routers = append(routers, apiRouter.Host(
|
||||||
fmt.Sprintf("%s.%s:%d", "{bucket:.+}", s3a.option.DomainName, s3a.option.Port)).Subrouter())
|
fmt.Sprintf("%s.%s:%d", "{bucket:.+}", domainName, s3a.option.Port)).Subrouter())
|
||||||
routers = append(routers, apiRouter.Host(
|
routers = append(routers, apiRouter.Host(
|
||||||
fmt.Sprintf("%s.%s", "{bucket:.+}", s3a.option.DomainName)).Subrouter())
|
fmt.Sprintf("%s.%s", "{bucket:.+}", domainName)).Subrouter())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter())
|
routers = append(routers, apiRouter.PathPrefix("/{bucket}").Subrouter())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue