add support for wildcard cors origin (#24)
This commit is contained in:
parent
5c9b3fa52c
commit
f894742c19
1 changed files with 2 additions and 2 deletions
4
cors.go
4
cors.go
|
|
@ -69,8 +69,8 @@ func (c Config) Validate() error {
|
||||||
return errors.New("conflict settings: all origins disabled")
|
return errors.New("conflict settings: all origins disabled")
|
||||||
}
|
}
|
||||||
for _, origin := range c.AllowOrigins {
|
for _, origin := range c.AllowOrigins {
|
||||||
if !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") {
|
if origin != "*" && !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") {
|
||||||
return errors.New("bad origin: origins must include http:// or https://")
|
return errors.New("bad origin: origins must either be '*' or include http:// or https://")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue