mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
feat: improve getOriginFromHost() for local machine name
This commit is contained in:
@ -65,10 +65,13 @@ func getOriginFromHost(host string) (string, string) {
|
||||
return origin, origin
|
||||
}
|
||||
|
||||
// "door.casdoor.com"
|
||||
protocol := "https://"
|
||||
if strings.HasPrefix(host, "localhost") {
|
||||
if !strings.Contains(host, ".") {
|
||||
// "localhost:8000" or "computer-name:80"
|
||||
protocol = "http://"
|
||||
} else if isIpAddress(host) {
|
||||
// "192.168.0.10"
|
||||
protocol = "http://"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user