# Troubleshooting WebRTC connection failures with Caddy reverse proxy

**URL:** <https://community.livekit.io/t/troubleshooting-webrtc-connection-failures-with-caddy-reverse-proxy/236>\
**Category:** Self Hosting\
**Tags:** other\
**Created:** [January 21, 2026, 3:52pm UTC](https://community.livekit.io/t/troubleshooting-webrtc-connection-failures-with-caddy-reverse-proxy/236 "2026-01-21T15:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiveKit-Community](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/livekit-community/32/67_2.png) [@LiveKit-Community](https://community.livekit.io/u/LiveKit-Community)\
**Post date:** [January 21, 2026, 3:52pm UTC](https://community.livekit.io/t/troubleshooting-webrtc-connection-failures-with-caddy-reverse-proxy/236/1 "2026-01-21T15:52:00Z")

</div>

_This question originally came up in our Slack community and the thread has been consolidated here for long-term reference._

I’m self-hosting LiveKit on Ubuntu VM behind Caddy reverse proxy. The LiveKit server and token generator are working, but my frontend can’t connect.

Browser shows:

- WebSocket to `wss://domain.com/rtc` opens then closes instantly
- GET `/rtc/rtc/validate` returns 404
- ICE connection state goes from `new → closed` immediately

LiveKit logs show it fails to detect external IP. Should I set `rtc.use_external_ip: true` and `external_ip` in livekit.yaml?

---

<div class="post-metadata">

**Author:** ![LiveKit-Community](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/livekit-community/32/67_2.png) [@LiveKit-Community](https://community.livekit.io/u/LiveKit-Community)\
**Post date:** [January 21, 2026, 3:52pm UTC](https://community.livekit.io/t/troubleshooting-webrtc-connection-failures-with-caddy-reverse-proxy/236/2 "2026-01-21T15:52:03Z")

</div>

There were a couple of root causes found here:

**1. Duplicate `/rtc` in URL:** The URL was `wss://domain.com/rtc/rtc` - the `/rtc` gets appended automatically, so remove it from your base URL configuration.

**2. External IP detection:** The server couldn’t discover or advertise its external IP properly, causing ICE/DTLS handshake failures.

**Debugging tips:**

- Use `chrome://webrtc-internals/` in one tab while connecting in another - this gives you all WebRTC debug info in real-time
- Check what ICE candidates are being advertised
- Verify your websocket URL is correct and DNS is resolving properly

**Common causes of ICE failures:**

- VPN interference - disable VPN for testing
- Missing or incorrect `external_ip` configuration
- TURN not configured when needed

For production environments, discuss TURN/STUN configuration options to ensure reliable connectivity.
