cloudwego/hertz-examples

跨域demo没有生效

godsoul opened this issue · 2 comments

Describe the bug

运行 middleware/CORS 下代码,返回的请求头还是没有带跨域的,option请求也会返回404

Hertz version:

v0.1.0

Environment:
GOVERSION="go1.18.3"

Additional context

h.Use(cors.New(cors.Config{
		AllowOrigins:     []string{"*"},              // Allowed domains, need to bring schema
		AllowMethods:     []string{"*"},              // Allowed request methods
		AllowHeaders:     []string{"*"},              // Allowed request headers
		ExposeHeaders:    []string{"Content-Length"}, // Request headers allowed in the upload_file
		AllowCredentials: true,                       // Whether cookies are attached
		MaxAge:           12 * time.Hour,             // Maximum length of upload_file-side cache preflash requests (seconds)
	}))

必须发带Origin的头