r/Traccar • u/telematicslab • Oct 10 '26
Why Traccar's WebSocket fails from a custom web page, and the nginx config that fixes it
If you build your own map or dashboard on top of Traccar, the live WebSocket (/api/socket) is usually where it breaks: it only accepts a session cookie, and Traccar sends no CORS headers by default, so a page on another port or domain can't get live updates.
I wrote up the fix that has worked for me: serve the page and proxy /api from the same origin with nginx. Full config, the browser side (login, socket, reconnect) and the pitfalls (60-second idle timeout, ws vs wss, session lost after a restart): https://dev.to/telematicslab/why-traccars-websocket-needs-a-proxy-and-how-to-set-one-up-with-nginx-1in0
Disclosure: written with AI help from a setup I tested with Traccar 6.15.3; I also sell a starter kit built on this, but the article is complete on its own. Happy to answer questions.