How to run gradio with 0.0.0.0 and https?

I want to run gradio app with server_name="0.0.0.0" and share=False and support https.
I didn’t saw any examples of how to support https with gradio.

How can I do it ?

I have tried to create ssl keys:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes

and run my app via:

demo.queue().launch(share=False,
                        debug=False,
                        server_name="0.0.0.0",
                        ssl_certfile="cert.pem",
                        ssl_keyfile="key.pem")

but I’m getting error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=7860): Max retries exceeded with url: /startup-events (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)')))

What are the simple steps to run gradio with 0.0.0.0 and https ?

1 Like

I have the same error. No solution so far. Will post if I found any.

Same error posted on How to run gradio with 0.0.0.0 and https ? · gradio-app/gradio · Discussion #4003 · GitHub

try ssl_verify=False

launch(ssl_verify=False, ....)

More context here Supporting HTTPS when running locally · Issue #563 · gradio-app/gradio · GitHub

1 Like

That solves it for me. Thanks @radames !

1 Like