统一开发端口说明与运行探活
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-09-07 16:16:33 +08:00
parent 362cf0d4cc
commit 8ee5f6083a
4 changed files with 9 additions and 12 deletions

View File

@ -186,7 +186,7 @@ PMail 原版的协议登录流程与 Smail 不兼容,不能直接作为 Smail
2、后端: golang + MySQL/SQLite
后端代码位于 `backend/`;推荐使用 `deploy/build.ps1` 构建后,通过 `deploy/start-dev.ps1` 启动开发服务。
后端代码位于 `backend/`;推荐使用 `deploy/build.ps1` 构建后,通过 `deploy/start-dev.ps1` 启动开发服务。当前开发端口固定分工为:前端使用 HTTP `80` 和 HTTPS `443`,后端 API 使用 `5201`;前端通过代理访问后端,浏览器统一打开 HTTPS 前端地址。
3、编译项目

View File

@ -78,10 +78,7 @@ func sslUpdateLoop() {
// 新增:HTTP 就绪探测(最多等待 ~90 秒)
func waitHTTPReady() bool {
port := 80
if cfg := config.CurrentConfig(); cfg != nil && cfg.HttpPort > 0 {
port = cfg.HttpPort
}
port := config.CurrentHTTPConfig().Port
if port < 1 || port > 65535 {
log.Warnf("invalid HTTP port %d, skipping SSL update this round", port)
return false

View File

@ -32,13 +32,13 @@
https://mail.example.com
```
请替换为实际的 Smail Web 地址。开发环境也可以使用:
请替换为实际的 Smail Web 地址。开发环境通过前端 HTTPS 入口访问:
```text
http://127.0.0.1:80
https://xuans.com
```
生产环境应优先使用 HTTPS。
开发后端 API 独立监听 `http://127.0.0.1:5201`,由前端开发服务代理 `/api` 和 `/attachments` 请求。浏览器不应绕过前端入口直接访问后端端口。生产环境应始终使用正式 HTTPS 入口。
### 2.2 通用响应格式
@ -767,4 +767,4 @@ Content-Disposition: attachment; filename="attachment"; filename*=UTF-8''report.
- 邮件发送:`backend/controllers/email/send.go`
- 统一 JSON 响应:`backend/dto/response/response.go`
原版对照来源为 PMail Wiki 的《后端接口文档》。原版文档仅作为历史兼容性参考,接口是否可调用以当前 Smail 路由和处理器实现为准。
原版对照来源为 PMail Wiki 的《后端接口文档》。原版文档仅作为历史兼容性参考,接口是否可调用以当前 Smail 路由和处理器实现为准。

View File

@ -12,13 +12,13 @@ yarn
yarn dev
```
开发代理默认连接本机 HTTPS 后端 `https://127.0.0.1:443`。如果后端使用其他地址,请在 `frontend/.env.development` 中设置:
开发环境由前端占用 HTTP `80` 和 HTTPS `443`,后端 API 独立监听 `5201`。前端开发代理默认连接本机后端 `http://127.0.0.1:5201`。如果后端使用其他地址,请在 `frontend/.env.development` 中设置:
```env
VITE_DEV_BACKEND_URL=https://127.0.0.1:443
VITE_DEV_BACKEND_URL=http://127.0.0.1:5201
```
自签名证书仅用于本地开发,代理不会校验证书链;生产环境应使用有效证书。
前端开发服务使用 `config/ssl` 下的证书提供 HTTPS,HTTP `80` 只负责跳转到 HTTPS。生产环境应使用有效证书,并由正式 Web 服务器承载前端入口。
### 生产构建