I've got a basic Flask server setup with some endpoints. I'm trying to test this out using curl (I've tried both from localhost and remotely, the result is the same).
If I curl the path over http, it works great. If I do it over https, the request looks like garbage (see below) and curl returns "curl: (35) gnutls_handshake() failed: An unexpected TLS packet was received."
Requests received over https typically looks similar to:
136.152.142.32 - - [16/Nov/2017 01:32:56] code 400, message Bad request syntax ('\x16\x03\x01\x00\xe3\x01\x00\x00\xdf\x03\x03Z\x0c\xea\xcf\rG\x12,\xea}\xc4\x17n\xb7\x0c\x0b\xea\xdbM\x87n\xf3\x95\xa7(\x15+\xb5lyzY\x00\x00n\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0')
136.152.142.32 - - [16/Nov/2017 01:32:56] "??Z
G,?}?n?
??
I added SSL functionality by simply adding an ssl_context to my flask app.
if __name__ == '__main__':
context = ('fullcert.pem', 'privkey.pem')
app.run(debug=False, ssl_context=context)
The keys are signed by a CA and worked fine in a comparable node application (I'm trying to convert that node application over to python/flask).
I've tried basically reinstalling from the ground up with no success.
This is being hosted on DigitalOcean in case anyone knows of some weird default configuration that they do that could be causing this. I've specifically opened the port that the application is running on.
Does anyone have any other suggestions of what could be causing the problem?