- UX audit Fix 1-5: actionable MCP HandoffSurface (endpoint/discovery/onboarding), reachable approval loop (sidebar section + waiting-for-me badge), honest MCP entry labels, ROUTES SSOT for dashboard-testing/load-testing (+ link-integrity coverage) - scenario registry hub (/dashboard-testing/scenarios) built on ScenarioRegistryModel - admin MCP governance: read-only GET /api/admin/mcp/catalog (catalog x roles + DCR clients) + /admin/mcp page/model/api + ROUTES.admin.mcp + sidebar entry - full i18n sweep of dashboard-testing routes and scenario-* component trees (ru/en) - accumulated workspace: MCP OAuth/DCR, automation idempotency migration, docker/nginx, specs
93 lines
3.5 KiB
Nginx Configuration File
93 lines
3.5 KiB
Nginx Configuration File
# #region docker.nginx.conf [C:3] [TYPE Module] [SEMANTICS nginx,proxy,frontend,api,ws,observability]
|
|
# @BRIEF HTTP-only nginx config — serves SvelteKit static files, proxies API/WS, and emits correlated JSON access logs.
|
|
# @PRE Docker DNS resolves backend:8000; built SvelteKit output at /usr/share/nginx/html.
|
|
# @POST Static SPA fallback works; /api/ and /ws/ reach backend with upgrade headers.
|
|
# Proxy access records are JSON on stdout and include client X-Trace-ID/timings.
|
|
# @LAYER Infrastructure
|
|
# @RELATION DEPENDS_ON -> [docker.frontend.entrypoint]
|
|
# @RELATION BINDS_TO -> [backend:8000]
|
|
# @INVARIANT /api/ and /ws/ preserve request URI, Authorization, and X-Trace-ID headers.
|
|
# @RATIONALE stdout JSON logs survive container log aggregation and make nginx/backend event correlation queryable.
|
|
# @REJECTED Nginx HTTPS in this file rejected — SSL variant selected only when certificates exist.
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# JSON access records are container-stdout friendly and correlate proxy and backend
|
|
# activity through the client-provided X-Trace-ID header.
|
|
log_format observability_json escape=json '{'
|
|
'"ts":"$time_iso8601",'
|
|
'"trace_id":"$http_x_trace_id",'
|
|
'"request_id":"$request_id",'
|
|
'"remote_addr":"$remote_addr",'
|
|
'"method":"$request_method",'
|
|
'"uri":"$uri",'
|
|
'"status":$status,'
|
|
'"upstream_status":"$upstream_status",'
|
|
'"request_time":$request_time,'
|
|
'"upstream_response_time":"$upstream_response_time"'
|
|
'}';
|
|
|
|
access_log /dev/stdout observability_json;
|
|
error_log /dev/stderr warn;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
|
|
location /api/ {
|
|
set $backend_api http://backend:8000;
|
|
proxy_pass $backend_api;
|
|
proxy_http_version 1.1;
|
|
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-Trace-ID $http_x_trace_id;
|
|
proxy_read_timeout 300s;
|
|
}
|
|
|
|
# Same public origin for Streamable HTTP, OAuth and RFC 9728 discovery.
|
|
# @RATIONALE Preserve the external port and stream SSE without buffering.
|
|
# @REJECTED SPA fallback for MCP paths returned HTML instead of protocol responses.
|
|
location ~ ^/(mcp(?:/|$)|oauth/|\.well-known/) {
|
|
set $backend_mcp http://backend:8000;
|
|
proxy_pass $backend_mcp;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Trace-ID $http_x_trace_id;
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 300s;
|
|
}
|
|
|
|
location /ws/ {
|
|
set $backend_ws http://backend:8000;
|
|
proxy_pass $backend_ws;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
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-Trace-ID $http_x_trace_id;
|
|
proxy_read_timeout 300s;
|
|
}
|
|
}
|
|
# #endregion docker.nginx.conf
|