'Python Flask web server running on IIS via FastCGI gets ERR_CERT_COMMON_NAME_INVALID on Chrome/Edge, but works in Opera?

I have a Flask app running with a cert/key created in openssl:

app.run(host="192.168.0.2", port=8000, debug=True, ssl_context=('/certs/fullchain.pem', '/certs/privkey.pem'))

The Flask app is being served on IIS via FastCGI. enter image description here

The actual website is using a .pfx created with the same fullchain.pem and privkey.pem files from openssl.

When I use the Flassk app (api) from the web app (ajax call) in Opera, everything works as expected... but when attempting to use it from any other browser, I get ERR_CERT_COMMON_NAME_INVALID.

I thought it may be due to the Flask app using 192.168.0.2 VS the "example.com" the cert is assigned to, but I have no way around this. Certs cannot be assigned to raw IPs.

Any suggestions would be GREATLY appreciated, thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source