6708c226a5
- 迁移 000023 gateway.file_objects(personal/system 归属隔离 + 部分索引) - internal/platform/storage:minio-go 适配(端点 scheme 剥离、流式 PutObject/Open/Delete) - internal/workbench/files.go:FileService(sha256 校验、PutObject-then-insert 回滚、delete 先删行再删对象) - admin /api/v1/admin/files + portal /api/v1/portal/files 处理器(流式上传下载、Content-Disposition) - RBAC file:read/file:manage;菜单加文件管理 + 门户文件仓库 - compose 增 minio 服务(S3_* anchor、不暴露端口);nginx client_max_body_size 32m→256m - 管理端文件管理页 + 门户个人文件仓;集成测试 TestFileObjectLifecycle 连真 MinIO 通过 - healthz object_storage:true;README/PRODUCTION/进展文档同步 Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
2.4 KiB
Plaintext
72 lines
2.4 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
# Keep Location headers relative (Location: /admin/) instead of letting
|
||
# nginx absolute_redirect rebuild them from $host + the listening port.
|
||
# The gateway is commonly published behind a non-standard port (e.g. 18081),
|
||
# and an absolute redirect would drop that port and send browsers to :80.
|
||
absolute_redirect off;
|
||
|
||
# 256 MiB 必须盖过文件上传上限 S3_MAX_FILE_BYTES(默认 128 MiB)。文件体
|
||
# 由网关的流式上传处理器把关(http.MaxBytesReader + LimitReader),
|
||
# nginx 只做最外层限制,避免大文件在到达网关前就被 413 拒绝。
|
||
client_max_body_size 256m;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
location = / {
|
||
return 302 /__APP__/;
|
||
}
|
||
|
||
location = /__APP__ {
|
||
return 301 /__APP__/;
|
||
}
|
||
|
||
location = /healthz {
|
||
proxy_pass http://gateway-api:8080/healthz;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
location = /readyz {
|
||
proxy_pass http://gateway-api:8080/readyz;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
location /api/ {
|
||
proxy_pass http://gateway-api:8080;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Request-ID $request_id;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
# nginx 是控制台(/api/)的唯一入口:用 $remote_addr 覆盖 X-Forwarded-For,
|
||
# 避免客户端自带 X-Forwarded-For 头伪造来源 IP、绕过登录限流。
|
||
proxy_set_header X-Forwarded-For $remote_addr;
|
||
}
|
||
|
||
location /v1/ {
|
||
proxy_pass http://gateway-api:8080;
|
||
proxy_http_version 1.1;
|
||
proxy_buffering off;
|
||
proxy_read_timeout 600s;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Request-ID $request_id;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
# Vite emits assets and client-side routes below /admin/ or /portal/.
|
||
location /__APP__/ {
|
||
try_files $uri $uri/ /__APP__/index.html;
|
||
}
|
||
|
||
location / {
|
||
return 404;
|
||
}
|
||
}
|