Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

Flask Server inside Docker with VSCode automatic port forwarding generates ERR_INVALID_HTTP_RESPONSE

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...