Skip to content

Commit

Permalink
fix cors domain normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 committed Feb 21, 2024
1 parent f9fcb02 commit 70f21d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions middleware/cors/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ func normalizeDomain(input string) string {
input = strings.TrimPrefix(strings.TrimPrefix(input, "http://"), "https://")

// Find and remove port, if present
if portIndex := strings.Index(input, ":"); portIndex != -1 {
input = input[:portIndex]
if len(input) > 0 && input[0] != '[' {
if portIndex := strings.Index(input, ":"); portIndex != -1 {
input = input[:portIndex]
}
}

return input
Expand Down

0 comments on commit 70f21d5

Please sign in to comment.