Я использую gin для работы с http запросами. Я описал cors так
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
//some code
router := gin.Default()
router.Use(cors.New(cors.Config{
AllowOrigins: []string{"http://localhost:3000"},
AllowMethods: []string{"PUT", "PATCH", "POST", "GET", "DELETE"},
AllowHeaders: []string{"Origin", "Authorization", "Content-Type", "Accept-Encoding"},
ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Credentials", "Access-Control-Allow-Headers", "Access-Control-Allow-Methods"},
AllowCredentials: true,
AllowOriginFunc: func(origin string) bool {
return origin == "http://localhost:3000"
},
MaxAge: 12 * time.Hour,
}))
Дальше я отправляю fetch patch запрос с домена "
localhost:3000" и вижу ошибку
Access to fetch at 'localhost:4040/api/user' from origin 'localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
PATCH localhost:4040/api/user net::ERR_FAILED 307
Я указал AllowOrigin, но всё равно вижу ошибку. Помогите исправить