How does one handle integrating an SSL certificate with a Reflex app hosted in a docker container? Are there Reflex config changes to be made or is it all handled by the image or Docker?
I’ve added this into my dockerfile, but it seems to be ineffective. I’m using python:3.11 as base.
‘’’
ADD /certs/generic_cert.crt /etc/ssl/certs/generic_cert.crt
RUN update-ca-certificates
‘’’
Does anyone know how to configure a Reflex app to use a SSL certificate? I’ve been struggling with this for a week now going through nginx proxy manager configs, dockerfiles, and trying to search through the Reflex github. The problem I’m running into is the web app frontend will show up when I turn SSL on in the proxy manager, but the backend/server/websocket times out or can’t be reached. I’ve used the Self-Hosting with Docker article on the Reflex blog as the reference for nginx config although I’m not using Docker Compose, it’s just Docker engine and a dockerfile to build the image.
Hey Alek,
Thanks for the suggestion. I ended up using the single port docker example to pass everything through one place and let it all be handled internally in the container. I couldn’t get the two port without Caddy to work with nginx.
This is in conjunction with a compose.yaml that runs the reflex app in the backend service. Env vars are substituted on startup of the nginx container.
The key is the location block for the /_event to enable the backend to work.
SSL certificates are mounted in the compose.yaml file, and automatically renewed by a separate certbot container with a bit of trickery in order for the nginx server to restart automatically when the certificates are renewed.