swagger-api / swagger-api/swagger-ui
swagger-ui-bundle.js GET request hangs while trying to load swagger-ui page served from flask/waitress on an IP other than localhost
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A
- OS: Windows 10
- Browser: Chrome 80.0.3987.122, Firefox 73.0.1
- Method of installation: through pip install flask-swagger-ui and updating swagger-ui /dist to the latest release obtained from https://github.com/swagger-api/swagger-ui/releases/tag/v3.25.0
- Swagger-UI version: 3.25.0
- Swagger/OpenAPI version: Swagger 3.0, OpenAPI 3.0
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...
- Create a hello world flask project using the flask-swagger-ui python package (https://github.com/sveint/flask-swagger-ui#usage)
- Update the flask-swagger-ui py package /dist directory to contain the latest swagger-ui release
- Run the server with the real IP address of the system (not using localhost)
- 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

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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Swagger UI 3.25.0 page through Flask/Waitress on a non-localhost IP and observe the GET for swagger-ui-bundle.js alongside the other static assets. Compare how swagger-ui-bundle.js is loaded and served with swagger-ui-standalone-preset.js and swagger-ui.css. Done means the page loads successfully through an IP or URL in Chrome and Firefox, as it does through localhost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100