Reputation: 39
I am running a Flask API application, and I have an SSL Certificate. When I run flask server on localhost the certificate is applied from Flask successfully.
But when I use Ngrok to deploy the localhost on a custom domain, the certificate is changed to *.ngrok.com, how can I change that to my certificate?.
EDIT #1: I already have a certificate for the new hostname and I have already applied it on Flask, but ngrok is changing it.
Upvotes: 0
Views: 3489
Reputation: 6296
From the description on the ngrok docs, all TLS connections are terminated by ngrok. So, if you want to terminate your own TLS connections then you have to setup a custom domain as explained here, so that the domain matches the certificate. You can see more details on TLS tunnels part of the docs.
Upvotes: 2
Reputation: 522442
You expose your service through the URL *.ngrok.com. A browser or other client will make a request to *.ngrok.com. The certificate presented there must be valid for *.ngrok.com. If *.ngrok.com presents a certificate for example.com, any valid HTTPS client would reject it because the names do not match, which by definition makes it an invalid certificate and is a flag for a potential security problem, exactly what HTTPS is designed to mitigate.
If you want to present your certificate for example.com to the client, you need to actually host your site at example.com
Upvotes: 0