mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-25 03:40:10 +01:00
17 lines
296 B
Go
17 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()
|
|
}
|