mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-10 01:02:55 +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
|
return origin, origin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "door.casdoor.com"
|
||||||
protocol := "https://"
|
protocol := "https://"
|
||||||
if strings.HasPrefix(host, "localhost") {
|
if !strings.Contains(host, ".") {
|
||||||
|
// "localhost:8000" or "computer-name:80"
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
} else if isIpAddress(host) {
|
} else if isIpAddress(host) {
|
||||||
|
// "192.168.0.10"
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user