Compare commits

...

2 Commits

Author SHA1 Message Date
Lakhan Samani
c948c98e94 Merge pull request #298 from authorizerdev/fix/url-parsing
fix: remove extra slash from host
2022-11-24 19:13:50 +05:30
Lakhan Samani
e985e096bc fix: remove extra slash from host 2022-11-24 12:58:04 +05:30

View File

@@ -20,12 +20,12 @@ func GetHost(c *gin.Context) string {
authorizerURL = ""
}
if authorizerURL != "" {
return authorizerURL
return strings.TrimSuffix(authorizerURL, "/")
}
authorizerURL = c.Request.Header.Get("X-Authorizer-URL")
if authorizerURL != "" {
return authorizerURL
return strings.TrimSuffix(authorizerURL, "/")
}
scheme := c.Request.Header.Get("X-Forwarded-Proto")
@@ -33,7 +33,7 @@ func GetHost(c *gin.Context) string {
scheme = "http"
}
host := c.Request.Host
return scheme + "://" + host
return strings.TrimSuffix(scheme+"://"+host, "/")
}
// GetHostName function returns hostname and port