I just setup new LiveKit server in production, do ...
# ask-ai
b
I just setup new LiveKit server in production, do I actually need to expose ports such as 7880? Since I am running caddy, wont everything go through it?
t
Thanks for reaching out, Vytautas. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When you're running a LiveKit server with Caddy, there's no need to expose port 7880 directly to the public internet. Caddy kindly steps in as a reverse proxy, handling TLS termination and forwarding traffic safely to port 7880 on your LiveKit server. Here's how it works: • Caddy listens on ports 80 (HTTP) and 443 (HTTPS) to receive incoming client connections. • It securely forwards WebSocket and HTTP requests to your internal LiveKit server on port 7880. • It's important to keep port 7880 hidden from the public for security. That said, to make sure WebRTC and related traffic flow smoothly, you'll want to expose these ports: • TCP 7881 — used for ICE/TCP, which acts as a fallback when UDP is blocked. • UDP 50000–60000 (or a custom range) — for ICE/UDP media traffic. • Optionally, UDP 7882 — if you're using UDP mux to simplify media traffic on a single port. This setup helps keep your WebRTC communication secure, scalable, and running smoothly, while also protecting your internal services. If you have any questions or need a hand with this, feel free to reach out—I'm here to help! Sources: Ports and firewall | LiveKit Docs
b
So do I set turn tls_port to 443 in livekit.yml?
t
Absolutely! When you're using Caddy without an extra load balancer, it's best to set
turn.tls_port
to 443 in your
livekit.yml
file. This helps make sure that TURN/TLS traffic is correctly communicated to your clients and can smoothly get through any restrictive firewalls. If you need any help with this, feel free to ask—I'm here to support you! Sources: Deploying LiveKit | LiveKit Docs | Deploy to a VM | LiveKit Docs | Ports and firewall | LiveKit Docs | pkg/config/config.go
b
and what does external_tls mean in the livekit.yml?
t
Thank you for reaching out! The
external_tls
setting in
livekit.yml
comes into play when TLS termination is handled outside of LiveKit, like by a load balancer working at Layer 4 (L4). When you set this to true, here’s what happens: • LiveKit expects unencrypted traffic on the specified
tls_port
, since the TLS encryption and decryption are taken care of externally. • LiveKit will still advertise the
tls_port
as a TURN/TLS candidate to clients, so it looks like secure TLS traffic from their perspective. • You won’t need to provide certificate files (
cert_file
and
key_file
) in LiveKit’s configuration because TLS is being handled elsewhere. This setup can be really helpful, especially in environments where firewalls only allow standard HTTPS traffic (like over port 443). In these cases, TURN/TLS traffic will appear as regular HTTPS to the firewalls, making things smoother for you. Sources: pkg/config/config.go | Deploying LiveKit | LiveKit Docs | livekit-server/templates/NOTES.txt
b
But if my caddy.yaml has upstreams dial setup to myip:5349.. is that correct? Does it still mean that turn.tls_port should be 443, or should it be 5349?
t
It sounds like you have your
caddy.yaml
set to upstream dial to
myip:5349
, which is great! To make sure everything works smoothly, you'll want to set
turn.tls_port
in your
livekit.yml
to 5349. This way, Caddy, which takes care of TLS termination, can properly forward the decrypted traffic to your LiveKit server on the right port. If you have any questions or need a hand with this, feel free to ask—I'm here to help! Sources: Deploying LiveKit | LiveKit Docs | Ports and firewall | LiveKit Docs