mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-10 17:30:27 +08:00
HTTP Header - CORS跨域设置增加多个选项
This commit is contained in:
@@ -5,13 +5,20 @@ package shared
|
||||
// HTTPCORSHeaderConfig 参考 https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
type HTTPCORSHeaderConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
AllowMethods []string `yaml:"allowMethods" json:"allowMethods"` // TODO
|
||||
AllowMethods []string `yaml:"allowMethods" json:"allowMethods"`
|
||||
AllowOrigin string `yaml:"allowOrigin" json:"allowOrigin"` // TODO
|
||||
AllowCredentials bool `yaml:"allowCredentials" json:"allowCredentials"` // TODO
|
||||
ExposeHeaders []string `yaml:"exposeHeaders" json:"exposeHeaders"` // TODO
|
||||
MaxAge int32 `yaml:"maxAge" json:"maxAge"` // TODO
|
||||
AllowCredentials bool `yaml:"allowCredentials" json:"allowCredentials"` // TODO,实现时需要升级以往的老数据
|
||||
ExposeHeaders []string `yaml:"exposeHeaders" json:"exposeHeaders"`
|
||||
MaxAge int32 `yaml:"maxAge" json:"maxAge"`
|
||||
RequestHeaders []string `yaml:"requestHeaders" json:"requestHeaders"` // TODO
|
||||
RequestMethod string `yaml:"requestMethod" json:"requestMethod"` // TODO
|
||||
RequestMethod string `yaml:"requestMethod" json:"requestMethod"`
|
||||
OptionsMethodOnly bool `yaml:"optionsMethodOnly" json:"optionsMethodOnly"`
|
||||
}
|
||||
|
||||
func NewHTTPCORSHeaderConfig() *HTTPCORSHeaderConfig {
|
||||
return &HTTPCORSHeaderConfig{
|
||||
AllowCredentials: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (this *HTTPCORSHeaderConfig) Init() error {
|
||||
|
||||
Reference in New Issue
Block a user