Echo middleware doesn't set headers

37 views Asked by At

I'm trying to use echo's middlware to set CORS headers.

Here's my code:

e := echo.New()

e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
        AllowOrigins: []string{`*`},
        AllowHeaders: []string{echo.HeaderXRequestedWith, echo.HeaderContentType, echo.HeaderAccept, echo.HeaderOrigin, echo.HeaderAuthorization, handler_package.HeaderHermesAdminPassword},
        AllowMethods: []string{http.MethodPost, http.MethodPut, http.MethodGet, http.MethodHead, http.MethodDelete},
        MaxAge:       1209600,
    }))

I don't see any of these headers in postman except allow origin with value "*" and "vary" with value "origin". What does it mean? How to fix it?

0

There are 0 answers