Webcam stream works properly, but snapshot is not

USB-camera Logitech C270 via mjpg-streamer.

Webcam stream works properly, but snapshot not working. If I try to get https://mywebsite/webcam/?action=stream everything is ok, but there is a problem to get https://mywebsite/webcam/?action=snapshot

As you can see in log-file there is an error:
octoprint.log (2.9 KB)

Of course mywebsite is the valid name of my site and ssl-certificate is valid too.

When I try to get content from a web-browser everything is ok.

The streaming url is consumed by the computer that has the browser you use to access Cura.
The snapshot url is consumed by the computer that is running OctoPrint. The computer running OctoPrint seems to have trouble resolving the https://mywebsite url.

If mjpg-streamer is running on the same computer as OctoPrint, try using http://127.0.0.1/webcam/?action=snapshot (while keeping the streaming url as you currently have it configured).

2 Likes

This is highly likely!
I just try to resolve my website name through nslookup and it is not resolved...

It seems DNS resolves my host right. But there is another problem. When I connect to my site via a console browser (like links or lynx) it says that my certificate has the wrong signature.
When I connect via firefox from the octoprint host - everything is ok. And certificate validation is ok too.
HTTPS traffic should be encripted/unencrypted by haproxy service, so I have a frontend to do it:

frontend website
mode http
bind :80
bind :443 ssl crt /etc/letsencrypt/live/mywebsite/pemfile.pem
http-request redirect scheme https code 301 unless { ssl_fc }
use_backend webcam if { path_beg /webcam/ }
use_backend octoprint if { path_beg /octoprint/ }
default_backend lighttp

I can't understand what's wrong...

There was something wrong with my pemfile.

I use:

cat fullchain.pem privkey.pem | tee pemfile.pem

Then I restarted haproxy, and checked certificate:

openssl s_client -connect 127.0.0.1:443 -servername mywebsite |head

Everything is ok, snapshot is working now!

Thank you!!!

Note that - as I alluded to in my first reply - it is a lot more efficient to use 127.0.0.1 in the snapshot url (and forego the ssl connection). This is OctoPrint accessing a service on the same computer; no need to go through the router or the reverse proxy.

1 Like

That's kinda like going around the block to get from your bedroom to your bathroom. Yeah, you get there, but your neighbors are gonna look at you funny for walking around the neighborhood in your pajamas. :stuck_out_tongue_winking_eye::rofl:

1 Like

@fieldOfView, @ryan780 ok, guys, I'm stupid. Of course, you are totally right!
http://127.0.0.1:8080/?action=snapshot works well.

2 Likes