harryboy
6 years agoOccasional Contributor
Swagger Python Flask server sluggish over HTTPS
I have a swagger openapi v3 python flask generated REST API server. I have just added HTTPS support to it and have used a self signed cert as follows.
CERTIFICATE_FILE = '/cert/server-cert.pem'
KEY_FILE = '/cert/server-key.pem'
def main():
app = connexion.App(__name__, specification_dir='./swagger/')
app.app.json_encoder = encoder.JSONEncoder
app.add_api('swagger.yaml', arguments={'title': 'My API'}, pythonic_params=True)
CORS(app.app)
app.run(port=8080, debug=True, ssl_context=(CERTIFICATE_FILE, KEY_FILE))I assess the swagger UI as follows:I notice that very often there is a very long rersponse time when the swagger UI loads in the web browser and lots of times it does not load at all and simply times out.
If I do not use HTTPS then it loads fine every time.
Why could this be?