3 Star 2 Fork 1

fotomxq/weeekj_core

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
core.go 625 Bytes
一键复制 编辑 原始数据 按行查看 历史
fotomxq 提交于 2025-02-05 18:52 +08:00 . 修改项目路径;
package RouterMidCore
import (
Router2SystemConfig "gitee.com/fotomxq/weeekj_core/v5/router2/system_config"
"github.com/gin-gonic/gin"
)
//gin中间件处理器
// SetOriginConfig 设置origin头部
func SetOriginConfig(c *gin.Context) {
switch Router2SystemConfig.HeaderOrigin {
case "*":
c.Writer.Header().Set("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
case "":
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
default:
c.Writer.Header().Set("Access-Control-Allow-Origin", Router2SystemConfig.HeaderOrigin)
}
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fotomxq/weeekj_core.git
git@gitee.com:fotomxq/weeekj_core.git
fotomxq
weeekj_core
weeekj_core
v5.4.18

搜索帮助