Skip to content

feat: add cors mw - #506

Closed
Becks723 wants to merge 2 commits into
west2-online:mainfrom
Becks723:feat/cors
Closed

feat: add cors mw#506
Becks723 wants to merge 2 commits into
west2-online:mainfrom
Becks723:feat/cors

Conversation

@Becks723

Copy link
Copy Markdown
Contributor

自查 PR 结构

  • PR 标题符合这个格式: <type>(optional scope): <description>

  • 此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。

  • 我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)

  • 这个 PR 属于强制变更/破坏性更改

如果是,请在 PR 标题中添加 BREAKING CHANGE 前缀,并在 PR 描述中详细说明。

这个 PR 的类型是什么?

这个 PR 做了什么 / 我们为什么需要这个 PR?

为管理面板添加跨域组件

(可选)这个 PR 解决了哪个/些 issue?

对 Reviewer 预留的一些提醒

@Becks723
Becks723 requested review from a team, jiuxia211 and ozline as code owners July 26, 2026 11:15
Comment thread cmd/api/main.go
h.Use(cors.New(cors.Config{
AllowOrigins: config.CORS.AllowOrigins,
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
AllowHeaders: []string{"Origin", "Accept", "Content-Type", "Authorization"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得 Headers 跨域塞个自定义

@linrongda

Copy link
Copy Markdown
Member

跨域应该在nginx里做吧,这里需要加吗?

@Becks723

Copy link
Copy Markdown
Contributor Author

跨域应该在nginx里做吧,这里需要加吗?

确实是这样更合理,等等我去看下

@Becks723

Copy link
Copy Markdown
Contributor Author

改成 nginx 配置,这个关了

@Becks723 Becks723 closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants