1
0
Fork 0

Fix ipv6 handling in redirect middleware

This commit is contained in:
Romain 2020-06-17 01:10:04 +02:00 committed by GitHub
parent 9f32292473
commit e5e46bf4ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 49 additions and 11 deletions

View file

@ -115,7 +115,7 @@ func rawURL(req *http.Request) string {
port := ""
uri := req.RequestURI
schemeRegex := `^(https?):\/\/([\w\._-]+)(:\d+)?(.*)$`
schemeRegex := `^(https?):\/\/(\[[\w:.]+\]|[\w\._-]+)?(:\d+)?(.*)$`
re, _ := regexp.Compile(schemeRegex)
if re.Match([]byte(req.RequestURI)) {
match := re.FindStringSubmatch(req.RequestURI)