This commit is contained in:
crusader 2018-04-11 21:14:23 +09:00
parent 4838bcba97
commit 378bf9183d

View File

@ -69,7 +69,10 @@ func New(co cors.Options) Cors {
break break
} else if i := strings.IndexByte(origin, '*'); i >= 0 { } else if i := strings.IndexByte(origin, '*'); i >= 0 {
// Split the origin in two: start and end string without the * // Split the origin in two: start and end string without the *
w := internal.Wildcard{origin[0:i], origin[i+1 : len(origin)]} w := internal.Wildcard{
Prefix: origin[0:i],
Suffix: origin[i+1 : len(origin)],
}
c.allowedWOrigins = append(c.allowedWOrigins, w) c.allowedWOrigins = append(c.allowedWOrigins, w)
} else { } else {
c.allowedOrigins = append(c.allowedOrigins, origin) c.allowedOrigins = append(c.allowedOrigins, origin)