'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.
CERT = '/cert/my-cert.pem'
KEY = '/cert/my-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=7000, debug=True, ssl_context=(CERT, KEY))
I assess the swagger UI as follows: https://10.190.111.23:7000/ui/
I notice that very often there is a very long response 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?
Solution 1:[1]
I had the same problem.
The solution was:
- remove the password from the private key: openssl rsa -in key-decrypt.pem -outform PEM -out key.pem
- use the original https port=443
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
