增加调试前端页面

This commit is contained in:
andy
2026-09-06 00:25:25 +08:00
parent 3080b17d02
commit ee9d2d7cf1
22 changed files with 1442 additions and 59 deletions

View File

@@ -3,6 +3,9 @@
# This file is intended to be included from nginx's http context (normally
# /etc/nginx/conf.d/*.conf). Replace the safe app-id in the exact chat
# location with the value configured in FIRE_SAFETY_CHAT_COMPAT_APP_ID.
# /chat and /chat/ are the optional public test page. They are always
# proxied here, while Go's FIRE_SAFETY_CHAT_PAGE_ENABLED switch decides
# whether they serve HTML or return 404.
# Never put FIRE_SAFETY_CHAT_AUTH_TOKEN, FIRE_SAFETY_MCP_AUTH_TOKEN, a
# SuperAgent key, or a database credential in this file.
@@ -34,6 +37,108 @@ server {
ssl_protocols TLSv1.2 TLSv1.3;
limit_req_status 429;
# Optional same-origin public test page. The Go handler serves the page
# only when FIRE_SAFETY_CHAT_PAGE_ENABLED=true; otherwise these exact
# routes return 404. The page never receives a token from Nginx.
location = /chat {
limit_req zone=fire_safety_chat burst=20 nodelay;
client_max_body_size 16k;
proxy_pass http://fire_safety_ymd_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Request-ID $request_id;
proxy_buffering on;
proxy_cache off;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_next_upstream off;
proxy_intercept_errors off;
}
location = /chat/ {
limit_req zone=fire_safety_chat burst=20 nodelay;
client_max_body_size 16k;
proxy_pass http://fire_safety_ymd_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Request-ID $request_id;
proxy_buffering on;
proxy_cache off;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_next_upstream off;
proxy_intercept_errors off;
}
# The page keeps CSS and JavaScript as same-origin static resources. Keep
# these locations exact and proxy them to Go so the Go page switch applies
# to the complete page surface (HTML, CSS and JavaScript).
location = /chat/app.css {
limit_req zone=fire_safety_chat burst=20 nodelay;
client_max_body_size 16k;
proxy_pass http://fire_safety_ymd_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Request-ID $request_id;
proxy_buffering on;
proxy_cache off;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_next_upstream off;
proxy_intercept_errors off;
}
location = /chat/app.js {
limit_req zone=fire_safety_chat burst=20 nodelay;
client_max_body_size 16k;
proxy_pass http://fire_safety_ymd_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Request-ID $request_id;
proxy_buffering on;
proxy_cache off;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_next_upstream off;
proxy_intercept_errors off;
}
# DashScope-compatible user chat. Keep this exact location restricted to
# the one configured app ID; do not replace it with a catch-all regex.
# The incoming xtoken is forwarded unchanged and validated by Go.