I am running a flask app inside docker on Mac. VSCode automatically generates the necessary port forwarding on the fly. However when I connect to the flask server on the url localhost: (server is started with app.run_server(host=None, debug=True, port=myport)), I receive the following errors:
Server side: code 400, message Bad HTTP/0.9 request type
Browser debug console: GET localhost:myport/...min.js net::ERR_INVALID_HTTP_RESPONSE
When I follow the requested urls manually, first I get a "page isn't working" error and after around 1 second the correct javascript code file is displayed in the browser.
When I set the docker port forwarding manually with the docker -p flag and run the server on '0.0.0.0' the problem disappears and the page loads fine.
Any ideas on how to fix or further debug this?
question from:
https://stackoverflow.com/questions/65876936/flask-server-inside-docker-with-vscode-automatic-port-forwarding-generates-err-i 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…