Browse Source

add support for wildcard cors origin (#24)

Matthew Baird 8 years ago
parent
commit
f894742c19
1 changed files with 2 additions and 2 deletions
  1. 2 2
      cors.go

+ 2 - 2
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