I have a jQuery Ajax call, like so:
$(\"#tags\").keyup(function(event) {
$.ajax({url: \"/terms\",
type: \"POST\",
contentType: \"ap
The default request_handler is WSGIRequestHandler.
Before app.run()
, Add one line,
WSGIRequestHandler.protocol_version = "HTTP/1.1"
Don't forget from werkzeug.serving import WSGIRequestHandler
.
Werkzeug's integrated web server builds on BaseHTTPServer from Python's standard library. BaseHTTPServer seems to support Keep-Alives if you set its HTTP protocol version to 1.1.
Werkzeug doesn't do it but if you're ready to hack into the machinery that Flask uses to instantiate Werkzeug's BaseWSGIServer, you can do it yourself. See Flask.run()
which calls werkzeug.serving.run_simple()
. What you have to do boils down to BaseWSGIServer.protocol_version = "HTTP/1.1"
.
I haven't tested the solution. I suppose you do know that Flask's web server ought to be used for development only.