diff --git a/cors.go b/cors.go index 6ce848b..1518108 100644 --- a/cors.go +++ b/cors.go @@ -159,11 +159,6 @@ func New(options Options) *Cors { c.allowedMethods = convert(options.AllowedMethods, strings.ToUpper) } - if c.allowedOriginsAll && c.allowCredentials { - // See https://github.com/rs/cors/issues/55 - log.Print("[cors] WARNING: unsafe configuration: AllowOrigin * and AllowCredientials true combined") - } - return c } @@ -274,7 +269,7 @@ func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) { c.logf(" Preflight aborted: headers '%v' not allowed", reqHeaders) return } - if c.allowedOriginsAll && !c.allowCredentials { + if c.allowedOriginsAll { headers.Set("Access-Control-Allow-Origin", "*") } else { headers.Set("Access-Control-Allow-Origin", origin) @@ -326,7 +321,7 @@ func (c *Cors) handleActualRequest(w http.ResponseWriter, r *http.Request) { return } - if c.allowedOriginsAll && !c.allowCredentials { + if c.allowedOriginsAll { headers.Set("Access-Control-Allow-Origin", "*") } else { headers.Set("Access-Control-Allow-Origin", origin) diff --git a/cors_test.go b/cors_test.go index a29ac4e..d3dbcba 100644 --- a/cors_test.go +++ b/cors_test.go @@ -83,7 +83,7 @@ func TestSpec(t *testing.T) { }, map[string]string{ "Vary": "Origin", - "Access-Control-Allow-Origin": "http://foobar.com", + "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Credentials": "true", }, },