Fix getting host
This commit is contained in:
@@ -33,10 +33,8 @@ func AppHandler() gin.HandlerFunc {
|
||||
var stateObj State
|
||||
|
||||
if state == "" {
|
||||
|
||||
stateObj.AuthorizerURL = hostname
|
||||
stateObj.RedirectURL = stateObj.AuthorizerURL + "/app"
|
||||
|
||||
stateObj.RedirectURL = hostname + "/app"
|
||||
} else {
|
||||
decodedState, err := utils.DecryptB64(state)
|
||||
if err != nil {
|
||||
|
@@ -10,12 +10,13 @@ import (
|
||||
|
||||
// GetHost returns hostname from request context
|
||||
func GetHost(c *gin.Context) string {
|
||||
scheme := "http"
|
||||
if c.Request.TLS != nil {
|
||||
scheme = "https"
|
||||
scheme := c.Request.Header.Get("X-Forwarded-Proto")
|
||||
if scheme != "https" {
|
||||
scheme = "http"
|
||||
}
|
||||
log.Println("=> url:", scheme+"://"+c.Request.Host)
|
||||
return scheme + "://" + c.Request.Host
|
||||
host := c.Request.Host
|
||||
log.Println("=> host:", scheme+"://"+host)
|
||||
return scheme + "://" + host
|
||||
}
|
||||
|
||||
// GetHostName function returns hostname and port
|
||||
|
Reference in New Issue
Block a user