Haproxy not serving webcam

Hello all... Happy Friday :slight_smile: First time poster here.
I am using octoprint under openmediavault's docker demon in an Atom D525 PC

My problem is similar to Webcam not working?
However, I am sure I have jpg_streamer working. I opened the container's 8080 port and can stream with this URL
http://myomv.local:8080/?action=stream -> shows my webcam at 640x480 with very high FPS
When I go to:
http://myomv.local:5000/webcam/?action=stream
I get "404 Not found"
And in my octoprint container log, I find:
2021-04-16 09:54:11,268 - tornado.access - WARNING - 404 GET /webcam/?action=stream&1618566856379 (10.0.0.37) 17.12ms
I wish I could see the haproxy log, but in the container console, I can't find /var/log/haproxy.log

This is my docker-compose.yml

version: '2.4'

services:
  octoprint:
    image: octoprint/octoprint
    restart: always
    ports:
      - 5000:5000
      - 8080:8080
    devices:
      - /dev/ttyUSB0:/dev/ttyACM0
      - /dev/video0:/dev/video0
    volumes:
     - octoprint:/octoprint
    # uncomment the lines below to ensure camera streaming is enabled when
    # you add a video device
    environment:
      - ENABLE_MJPG_STREAMER=true
  

volumes:
  octoprint:

Port 5000 points directly to octoprint, bypassing haproxy entirely. So your /webcam request goes to octoprint, not to haproxy, and haproxy does not get a chance to redirect the request to mjpgstreamer.

haproxy is used to access octoprint (and the webcam) on port 80. Try http://myomv.local:80/webcam/?action=stream. You may have to add the - 80:80 port to your docker-compose.yml.

2 Likes

You were SO RIGHT!
I thought that 5000 and 80 were the same thing for octoprint.
Actually, I can't use port 80 on my host, since it is connected to the open media vault admin web.
So I replaced the 5000:5000 with 5000:80, and it works through 5000.
Thank you!

1 Like