MSP-2684 Add using 'withPrefix' flag to avoid trimming request's url prefix

This commit is contained in:
Kirill Ryabov committed 2024-01-22 20:12:58 +07:00
1 parent 402c6c18cf
commit 8a83ba0b3a
2 files changed
+11 -5

No files matched your search

+5 -2
View File
@@ -111,12 +111,15 @@ 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,
location.PathPrefix,
l.logger,
prefixToTrim,
)
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
}