MSP-2684 Update Entrypoint function

This commit is contained in:
Kirill Ryabov committed 2024-01-22 21:02:51 +07:00
1 parent 87690bbd12
commit 1f40e9d5d3
2 files changed
+5 -9

No files matched your search

+2 -6
View File
@@ -71,7 +71,6 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
mux := mux2.NewRouter()
for _, location := range locations {
location := location
var proxyFunc middleware.Handler
enableBodyLog := config.Logging.BodyLogEnable
@@ -112,15 +111,12 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
middleware.ErrorHandler(l.logger),
)
}
var prefixToTrim *string
if !location.WithPrefix {
prefixToTrim = &location.PathPrefix
}
entrypoint := middleware.Entrypoint(
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:gomnd
handler,
l.logger,
prefixToTrim,
location.PathPrefix,
location.WithPrefix,
)
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
}