swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.66k stars 8.97k forks source link

swagger-ui-bundle.js GET request hangs while trying to load swagger-ui page served from flask/waitress on an IP other than localhost #5897

Open gmanlan opened 4 years ago

gmanlan commented 4 years ago

Q&A

Describe the bug you're encountering

When using Swagger-UI (through the flask-swagger-ui python package) and served with the flask/waitress web server, Swagger-UI works fine when using localhost but fails to load the page when using any IP/URL other than localhost. Specifically, the page hangs while trying to GET the static swagger-ui-bundle.js file (see screenshot). The workaround was to load swagger-ui-bundle.js using unpkg instead of loading the local version. It's interesting to notice that other static files (swagger-ui-standalone-preset.js, swagger-ui.css, etc.) are loading fine.

To reproduce...

  1. Create a hello world flask project using the flask-swagger-ui python package (https://github.com/sveint/flask-swagger-ui#usage)
  2. Update the flask-swagger-ui py package /dist directory to contain the latest swagger-ui release
  3. Run the server with the real IP address of the system (not using localhost)
  4. Attempt to load the swagger-ui page using Chrome or Firefox

Expected behavior

The swagger-ui page should load just fine, like when using localhost.

Screenshots

image

Additional context or thoughts

Since this problem is specifically related to the swagger-ui-bundle.js file, and because other static files are served correctly without problems, I assume this is not an issue related to python/flask/waitress.

ogaltsov commented 4 years ago

Have similar issue in production. springfox-swagger2-3.0.0-SNAPSHOT springfox-swagger-ui-3.0.0-SNAPSHOT springfox-spring-webflux-3.0.0-SNAPSHOT

HttpWebHandlerAdapter: 289 - Error [java.lang.OutOfMemoryError: Direct buffer memory] for HTTP GET "/webjars/springfox-swagger-ui/swagger-ui-bundle.js?v=3.0.0-SNAPSHOT", but ServerHttpResponse already committed (200 OK)

FedericoHeichou commented 3 years ago

I had the same problem and it was caused by a SOCKS5 proxy

Rupikz commented 2 years ago

I had the same problem and it was caused by log4j2. I disabled logging large body