mirror of
https://github.com/yusing/godoxy.git
synced 2025-12-29 20:40:17 -06:00
fix(cookie): net/http: invalid Cookie.Domain .0.0.1:3000
This commit is contained in:
@@ -59,6 +59,17 @@ func cookieDomain(r *http.Request) string {
|
||||
return ".local"
|
||||
}
|
||||
|
||||
// if the host is an IP address, return an empty string
|
||||
{
|
||||
host, _, err := net.SplitHostPort(reqHost)
|
||||
if err != nil {
|
||||
host = reqHost
|
||||
}
|
||||
if net.ParseIP(host) != nil {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
parts := strutils.SplitRune(reqHost, '.')
|
||||
if len(parts) < 2 {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user