Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// AllowOrigins 允许的源列表,如 ["http://localhost:3000", "https://example.com"]
// 使用 "*" 表示允许所有源(不推荐用于生产环境)
AllowOrigins []string
// AllowMethods 允许的 HTTP 方法
AllowMethods []string
// AllowHeaders 允许的请求头
AllowHeaders []string
// ExposeHeaders 暴露给客户端的响应头
ExposeHeaders []string
// AllowCredentials 是否允许携带凭证(Cookie、HTTP 认证等)
AllowCredentials bool
// MaxAge 预检请求的缓存时间(秒)
MaxAge int
}
Config CORS 配置
Click to show internal directories.
Click to hide internal directories.