Revert "feat: multiple-cors-allow-origin support (#7134)" (#7168)

This reverts commit 8a55801cc0.
This commit is contained in:
Ricardo Katz 2021-05-27 09:38:24 -03:00 committed by GitHub
parent 68ec350388
commit 11d4ddca8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 31 deletions

View file

@ -18,7 +18,6 @@ package cors
import (
"regexp"
"strings"
networking "k8s.io/api/networking/v1beta1"
@ -114,14 +113,7 @@ func (c cors) Parse(ing *networking.Ingress) (interface{}, error) {
}
config.CorsAllowOrigin, err = parser.GetStringAnnotation("cors-allow-origin", ing)
if err == nil {
for _, origin := range strings.Split(config.CorsAllowOrigin, ",") {
if !corsOriginRegex.MatchString(strings.TrimSpace(origin)) {
config.CorsAllowOrigin = "*"
break
}
}
} else {
if err != nil || !corsOriginRegex.MatchString(config.CorsAllowOrigin) {
config.CorsAllowOrigin = "*"
}