fix(docker): proxy /swaggerui so Swagger UI assets load behind nginx#37097
Open
sanidhyasin wants to merge 2 commits into
Open
fix(docker): proxy /swaggerui so Swagger UI assets load behind nginx#37097sanidhyasin wants to merge 2 commits into
sanidhyasin wants to merge 2 commits into
Conversation
The bundled nginx config proxies the API doc pages (e.g. /api/swagger-ui.html) but not the /swaggerui path where Flask-RESTX serves the Swagger UI static assets (CSS/JS). When SWAGGER_UI_ENABLED is true, the doc page therefore loads but its assets 404, leaving a blank page in Docker deployments. Add a /swaggerui location that proxies to the api service, matching the other API routes. Fixes langgenius#37019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #37019
When
SWAGGER_UI_ENABLED=true, the API serves Swagger UI doc pages (e.g./api/swagger-ui.html,/console/api/swagger-ui.html). Flask-RESTX serves the UI's static assets (CSS/JS) from the app-level/swaggeruipath.The bundled Docker nginx config (
docker/nginx/conf.d/default.conf.template) proxies the doc-page routes (/api,/console/api,/openapi, …) to theapiservice, but has no route for/swaggerui. As a result the doc page loads, but every static asset request 404s through nginx and the page renders blank.This PR adds a
/swaggeruilocation that proxies to theapiservice, matching the other API routes. This is exactly the workaround the issue reporter verified.The block contains no
${...}placeholders, so it is unaffected by the entrypoint'senvsubststep. The route is only meaningful whenSWAGGER_UI_ENABLEDis on; when disabled the API simply doesn't register those assets, so adding the proxy is harmless.Screenshots
/swaggerui/*assets 404 behind nginxChecklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods (N/A — change is limited to a Docker nginx config template).