Traefik
Learn how to use Traefik as a reverse proxy and load balancer to expose your LibreChat instance securely over HTTPS with automatic SSL/TLS certificate management.
Traefik is a modern HTTP reverse proxy and load balancer that makes it easy to deploy and manage your services. If you're running LibreChat on Docker, you can use Traefik to expose your instance securely over HTTPS with automatic SSL certificate management.
Prerequisites
- Docker and Docker Compose installed on your system
- A domain name pointing to your server's IP address
Configuration
Configure Traefik and LibreChat
In your docker-compose.override.yml file, add the following configuration:
Replace [email protected] with your email address for Let's Encrypt certificate notifications.
see: Docker Override for more info.
Start the containers
This will start Traefik and LibreChat containers. Traefik will automatically obtain an SSL/TLS certificate from Let's Encrypt and expose your LibreChat instance securely over HTTPS.
You can now access your LibreChat instance at https://your.domain.name. Traefik will handle SSL/TLS termination and reverse proxy requests to your LibreChat container.
Additional Notes
- The Traefik configuration listens on ports 80 and 443 for HTTP and HTTPS traffic, respectively. Ensure that these ports are open on your server's firewall.
- Traefik stores SSL/TLS certificates in the
./letsencryptdirectory on your host machine. You may want to back up this directory periodically. - For more advanced configuration options, refer to the official Traefik documentation: https://doc.traefik.io/
Static File Caching and Compression
LibreChat now supports static file caching and compression natively. If you're using Traefik to handle compression, you should disable compression in LibreChat to avoid redundant processing. You can do this by setting the DISABLE_COMPRESSION environment variable to true in your LibreChat configuration.
This will prevent LibreChat from compressing static files, allowing Traefik to handle compression more efficiently.
For more information on static file handling in LibreChat, including caching options, refer to the Static File Handling documentation.
How is this guide?