feat(tenant-api): expose Swagger UI in non-release mode
Adds an in-process Swagger UI and OpenAPI JSON under /swagger, registered automatically when the Gin mode is not release. The admin-web Vite dev server and production nginx config now proxy /swagger to the tenant API so the docs are reachable from the existing admin host. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,18 @@ server {
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# Proxy Swagger UI and OpenAPI JSON to the backend for API testing
|
||||
location ^~ /swagger {
|
||||
proxy_pass http://tenant-api:8080;
|
||||
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_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# Cache static assets aggressively
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
expires 1y;
|
||||
|
||||
@@ -58,6 +58,10 @@ export default defineConfig(({ mode }) => {
|
||||
target: env.VITE_API_PROXY_TARGET || "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/swagger": {
|
||||
target: env.VITE_API_PROXY_TARGET || "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
esbuild: isProd ? { drop: ["console", "debugger"] } : undefined,
|
||||
|
||||
Reference in New Issue
Block a user