Files
smart-go/docs/cors-https-checklist.md
2026-04-23 18:58:13 +08:00

14 lines
882 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CORS / HTTPS 清单(开发 → 生产)
## 开发(当前)
- Go 已加 [`internal/server/cors.go`](../internal/server/cors.go):仅 **Origin 为 `http://localhost:*` / `http://127.0.0.1:*` / `http://[::1]:*`** 时反射 `Access-Control-Allow-Origin` 并允许 **Credentials**
- 前端 `web/.env.local` 设置 `NEXT_PUBLIC_API_ORIGIN=http://127.0.0.1:8000`(与 Go 监听一致)。
- OAuth `redirect_uri` 须与 Go /oauth 客户端种子登记一致(如 `http://localhost:3000/oauth/callback`)。
## 生产
- **同源**Next 与 Go 同站点 / 反代为同一 Origin 时,浏览器 **简单请求无 CORS**;请关闭或收紧对公网暴露的 CORS。
- **HTTPS**Cookie `Secure``SameSite` 与 OAuth 重定向须用 **HTTPS**;参阅 `configs` 里 Session 配置。
- 多环境 `redirect_uri`:在 OAuth 客户端表中登记各环境回调 URL。