Skip to content

fix(docker): proxy /swaggerui so Swagger UI assets load behind nginx#37097

Open
sanidhyasin wants to merge 2 commits into
langgenius:mainfrom
sanidhyasin:fix/docker-nginx-swaggerui-route
Open

fix(docker): proxy /swaggerui so Swagger UI assets load behind nginx#37097
sanidhyasin wants to merge 2 commits into
langgenius:mainfrom
sanidhyasin:fix/docker-nginx-swaggerui-route

Conversation

@sanidhyasin

Copy link
Copy Markdown

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 /swaggerui path.

The bundled Docker nginx config (docker/nginx/conf.d/default.conf.template) proxies the doc-page routes (/api, /console/api, /openapi, …) to the api service, 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 /swaggerui location that proxies to the api service, matching the other API routes. This is exactly the workaround the issue reporter verified.

location /swaggerui {
  proxy_pass http://api:5001;
  include proxy.conf;
}

The block contains no ${...} placeholders, so it is unaffected by the entrypoint's envsubst step. The route is only meaningful when SWAGGER_UI_ENABLED is on; when disabled the API simply doesn't register those assets, so adding the proxy is harmless.

Screenshots

Before After
Swagger UI page is blank — /swaggerui/* assets 404 behind nginx Swagger UI renders correctly — assets are proxied to the API

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. (N/A — nginx config has no test harness.)
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods (N/A — change is limited to a Docker nginx config template).

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
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please repair Swagger/OpenAPI doc (Docker?)

1 participant