Fix ipv6 handling in redirect middleware
This commit is contained in:
parent
9f32292473
commit
e5e46bf4ed
11 changed files with 49 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue