MSP-1470 user gorilla muxer
This commit is contained in:
1 parent
d430e1e402
commit
bce6527dc7
5 files changed
+9
-4
No files matched your search
@@ -1,3 +1,5 @@
|
||||
### v4.1.1
|
||||
* исправлена маршрутизация запросов
|
||||
### v4.1.0
|
||||
* обновлены зависимости
|
||||
* добавлена поддержка проксирования WebSocket `ws`
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package assembly
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
mux2 "github.com/gorilla/mux"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"isp-gate-service/conf"
|
||||
"isp-gate-service/middleware"
|
||||
@@ -66,7 +66,7 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
|
||||
|
||||
enableBodyLog := config.Logging.BodyLogEnable
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux := mux2.NewRouter()
|
||||
for _, location := range locations {
|
||||
var proxyFunc middleware.Handler
|
||||
switch location.Protocol {
|
||||
@@ -111,7 +111,7 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
|
||||
location.PathPrefix,
|
||||
l.logger,
|
||||
)
|
||||
mux.Handle(fmt.Sprintf("%s/", location.PathPrefix), entrypoint)
|
||||
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
|
||||
}
|
||||
|
||||
return mux, nil
|
||||
|
||||
@@ -27,6 +27,7 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
|
||||
@@ -157,6 +157,8 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
|
||||
Reference in new issue
Block a user