Route RTSP Stream through Traefik

Hi there,

im running Frigate behind Traefik (both in Docker) and want to route a RTSP Stream through Traefik.
Is it generally possible?

Thanks

Should work, RTSP uses TCP and UDP, you just need to use the according routers and services.

The RTSP-Stream is on Port 8554 and tcp on 8555
The RTSP Stream ist available on rtsp://host:8554/cameraname

If i turn Traefik off it still works. :slight_smile:

The following konfiguration doesn't work.

   ## TCP Routers
    traefik.tcp.routers.frigatertsp.entrypoints: frigatertsp
    traefik.tcp.routers.frigatertsp.rule: HostSNI(`*`)
    traefik.tcp.routers.frigatertsp.service: frigatertsp
    ## Services - TCP
    traefik.tcp.services.frigatertsp.loadbalancer.server.address: 127.0.0.1:8554

Do you habe an example?

Did you create "frigatertsp" entrypoint in Traefik static config?

Share your full Traefik static and dynamic config and docker-compose.yml if used.

Hi,

yes i did. I just have this Config.

services:
  traefik:
    image: traefik:v2.11.2
    ports:
      - 80:80
      - 5000:5000
      - 8554:8554
      - 8555:8555/TCP
      - 8555:8555/UDP
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command:
      - --api.dashboard=true 
      - --api.insecure=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.frigate.address=:5000
      - --entrypoints.frigatertsp.address=:8554
      - --entrypoints.frigatetcp.address=:8555
      - --log.level=DEBUG 
    labels:
      traefik.enable: true
      traefik.http.routers.traefik.rule: Host(`myHOST`)
      traefik.http.routers.traefik.entrypoints: web
      traefik.http.routers.traefik.service: api@internal

      traefik.tcp.routers.frigatertsp.entrypoints: frigatertsp
      traefik.tcp.routers.frigatertsp.rule: HostSNI(`*`)
      traefik.tcp.routers.frigatertsp.service: frigatertsp
      traefik.tcp.services.frigatertsp.loadbalancer.server.address: 127.0.0.1:8554

    networks:
      - web

networks:
  web:
    name: traefik_web

Check doc how to create a UDP entrypoint. Same for router and service.

Okay my TCP and UDP Server are running. I tried to open the RTSP-Stream and it doesn't work.

What is my mistake?

   - --entrypoints.frigatertsp.address=:8554
   - --entrypoints.frigateudp.address=:8555/UDP
   - --entrypoints.frigatetcp.address=:8555/TCP
traefik.udp.routers.frigateudp.entrypoints: frigateudp
#  traefik.udp.routers.frigateudp.rule: HostSNI(`*`)
traefik.udp.routers.frigateudp.service: frigateudp
traefik.udp.services.frigateudp.loadbalancer.server.address: 127.0.0.1:8555
level=debug msg="Creating TCP server 0 at 172.20.0.3:1935" serverName=0 routerName=frigatertsp@docker entryPointName=frigatertsp serviceName=frigatertsp
level=debug msg="Adding route for \"HostSNI(`*`)\"" entryPointName=frigatertsp routerName=frigatertsp@docker
level=debug msg="Creating TCP server 0 at 172.20.0.3:1935" serviceName=frigatetcp serverName=0 entryPointName=frigatetcp routerName=frigatetcp@docker
level=debug msg="Adding route for \"HostSNI(`*`)\"" routerName=frigatetcp@docker entryPointName=frigatetcp
level=debug msg="Creating UDP server 0 at 172.20.0.3:1935" entryPointName=frigateudp routerName=frigateudp@docker serviceName=frigateudp serverName=0

You can not forward to localhost inside a container, it’s not localhost on your node/host.

I tried the IP of the Container of the Service itself and the private ip which calls the Stream. Both of them are not working.

You told me what im doing wrong… Can you tell me how it works?

Thanks

More things that don’t work: post

Where is frigate running? On node, in container?

It is another Container in the same Network.

LAN network, Docker network, same machine?

Same Host same Docker Network. The Host and Streaming Client are in the same LAN too

When target service is on the same node in Docker containers, you can just use Traefik Docker Configuration Discovery. You don’t need to set any target IPs, that’s done automatically.

Check simple Traefik example for minimum required labels.