Currently I am using flask server for socket programming. I want that server has to run on https instead of https with public statis IP. So that frontend app which is in react js can access this server securely.
I did try with adding cert.pem and key.pem files in flask code.
But not able to access securely with link “https://my_public_ip:5000”
It is showing not secure.
Here is the code
from flask import Flask
from flask_socketio import SocketIO
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app, cors_allowed_origins="*")
@socketio.on('connect')
def handle_connect():
print('Client connected')
@socketio.on('disconnect')
def handle_disconnect():
print('Client disconnected')
if __name__ == '__main__':
socketio.run(app, host='0.0.0.0', port=5000, ssl_context=('cert.pem', 'key.pem'))
I did try with adding cert.pem and key.pem files in flask code.
But not able to access securely with link “https://my_public_ip:5000”
It is showing not secure.
Nayan Mane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.