|
@ -626,8 +626,10 @@ func NewContext() { |
|
|
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/") |
|
|
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/") |
|
|
AppSubURLDepth = strings.Count(AppSubURL, "/") |
|
|
AppSubURLDepth = strings.Count(AppSubURL, "/") |
|
|
// Check if Domain differs from AppURL domain than update it to AppURL's domain
|
|
|
// Check if Domain differs from AppURL domain than update it to AppURL's domain
|
|
|
// TODO: Can be replaced with url.Hostname() when minimal GoLang version is 1.8
|
|
|
|
|
|
urlHostname := strings.SplitN(appURL.Host, ":", 2)[0] |
|
|
|
|
|
|
|
|
urlHostname, _, err := net.SplitHostPort(appURL.Host) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Fatal("Invalid host in ROOT_URL '%s': %s", appURL.Host, err) |
|
|
|
|
|
} |
|
|
if urlHostname != Domain && net.ParseIP(urlHostname) == nil { |
|
|
if urlHostname != Domain && net.ParseIP(urlHostname) == nil { |
|
|
Domain = urlHostname |
|
|
Domain = urlHostname |
|
|
} |
|
|
} |
|
@ -643,11 +645,10 @@ func NewContext() { |
|
|
default: |
|
|
default: |
|
|
defaultLocalURL = string(Protocol) + "://" |
|
|
defaultLocalURL = string(Protocol) + "://" |
|
|
if HTTPAddr == "0.0.0.0" { |
|
|
if HTTPAddr == "0.0.0.0" { |
|
|
defaultLocalURL += "localhost" |
|
|
|
|
|
|
|
|
defaultLocalURL += net.JoinHostPort("localhost", HTTPPort) + "/" |
|
|
} else { |
|
|
} else { |
|
|
defaultLocalURL += HTTPAddr |
|
|
|
|
|
|
|
|
defaultLocalURL += net.JoinHostPort(HTTPAddr, HTTPPort) + "/" |
|
|
} |
|
|
} |
|
|
defaultLocalURL += ":" + HTTPPort + "/" |
|
|
|
|
|
} |
|
|
} |
|
|
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL) |
|
|
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL) |
|
|
RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false) |
|
|
RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false) |
|
|