From f894742c196d528a81bd99556ba819bd06d71a4e Mon Sep 17 00:00:00 2001 From: Matthew Baird Date: Tue, 27 Jun 2017 21:27:08 -0700 Subject: [PATCH] add support for wildcard cors origin (#24) --- cors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cors.go b/cors.go index 16550f4..d5b912a 100644 --- a/cors.go +++ b/cors.go @@ -69,8 +69,8 @@ func (c Config) Validate() error { return errors.New("conflict settings: all origins disabled") } for _, origin := range c.AllowOrigins { - if !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") { - return errors.New("bad origin: origins must include http:// or https://") + if origin != "*" && !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") { + return errors.New("bad origin: origins must either be '*' or include http:// or https://") } } return nil