This is an informational post, which might help someone who runs into this issue.
I was having a problem whereby the webcam stream would not work on the Octoprint web page, but would work if accessed by the same URL directly from a Chrome browser.
For reference, the problem did not exist when using Firefox - everything worked fine.
I narrowed down the problem to me using both IPv4 and IPv6, and the fact that I run my own DNS server on my wired LAN segment (which is what the Octoprint server is connected to). Thus:
$ nslookup pigui Server: 2001:8b0:fb5e::31 Address: 2001:8b0:fb5e::31#53 Name: pigui.pickworth.me.uk Address: 192.168.1.40 Name: pigui.pickworth.me.uk Address: 2001:8b0:fb5e::40
The issue arose when I use this URL to access web site:
and the IPv4 address in the Octoprint webcam setting thus:
Looking in the Chrome console log when running test on the webcam link, I got CORS security errors, and Connection Denied.
From what I can see, this is caused by the Chrome DNS lookup on the server name (pigui) returning its IPv6 address (because Chrome is set to look for IPv6 first), and then seeing the IPv4 address of the webcam stream as a different, untrusted, network.
There are two solutions / workarounds that I found:
- Use Firefox, it "just works"(TM). However, it is possible that at some point in the future it could start doing what Chrome does.
- Explicitly use IPv4 addresses for both the Octoprint website and the webcam stream, so http://192.168.1.40 works in my case
I have not tried using the IPv6 address for the webcam stream, mainly because I need to access it from my wireless LAN, which is on a different, IPv4 only, sub net (ironically provided by Google hardware ).