Skip to content

Commit c948c98

Browse files
authored
Merge pull request #298 from authorizerdev/fix/url-parsing
fix: remove extra slash from host
2 parents 70bab70 + e985e09 commit c948c98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/parsers/url.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ func GetHost(c *gin.Context) string {
2020
authorizerURL = ""
2121
}
2222
if authorizerURL != "" {
23-
return authorizerURL
23+
return strings.TrimSuffix(authorizerURL, "/")
2424
}
2525

2626
authorizerURL = c.Request.Header.Get("X-Authorizer-URL")
2727
if authorizerURL != "" {
28-
return authorizerURL
28+
return strings.TrimSuffix(authorizerURL, "/")
2929
}
3030

3131
scheme := c.Request.Header.Get("X-Forwarded-Proto")
3232
if scheme != "https" {
3333
scheme = "http"
3434
}
3535
host := c.Request.Host
36-
return scheme + "://" + host
36+
return strings.TrimSuffix(scheme+"://"+host, "/")
3737
}
3838

3939
// GetHostName function returns hostname and port

0 commit comments

Comments
 (0)