1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

handle using withcredentials and allow origin * together

This commit is contained in:
Jean-Sébastien Ney 2018-06-19 15:27:36 +02:00 committed by Vishal Rana
parent 9b4cc60ce2
commit d63824fa41

View File

@ -94,6 +94,10 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
// Check allowed origins // Check allowed origins
for _, o := range config.AllowOrigins { for _, o := range config.AllowOrigins {
if o == "*" && config.AllowCredentials {
allowOrigin = origin
break
}
if o == "*" || o == origin { if o == "*" || o == origin {
allowOrigin = o allowOrigin = o
break break