mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +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()
|
|
}
|