mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
16 lines
296 B
Go
16 lines
296 B
Go
package main
|
|
|
|
import (
|
|
"net/url"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
func createTargetURL(prefix string, u *url.URL) string {
|
|
// Prevent from attacks with using `..` in r.URL.Path
|
|
u.Path = path.Clean(u.Path)
|
|
if !strings.HasPrefix(u.Path, "/") {
|
|
u.Path = "/" + u.Path
|
|
}
|
|
return prefix + u.RequestURI()
|
|
}
|