Files
ai-gateway-go/deploy/nginx-web.conf
T
superidou 5759c1862e AI Gateway Go 0.10.0 源码快照 + 旗舰版需求规划报告
M0-M7 已完成:核心网关(身份/RBAC/TOTP/OIDC/SAML/Provider/配额/路由/内容策略/审计/定价)+ 资源市场(MCP/Skills/数字员工)。
含 22 个 PostgreSQL 迁移、管理端/门户端前端源码、OpenAPI 契约、部署 compose。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-12 11:45:54 +08:00

72 lines
2.3 KiB
Plaintext
Raw 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.
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;
# Match the gateway's HTTP_MAX_BODY_BYTES (default 32 MiB). nginx's default
# of 1 MiB otherwise rejects large prompts and knowledge-base imports with
# 413 before they ever reach the gateway.
client_max_body_size 32m;
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;
}
}