Issue using HTTP Binding for Security Cam Feed in HABpanel/BasicUI Sitemap

Hey folks, hope you can help me out with this one, been trying a number of things over the last 3 days to no avail. Hopefully it’s something simple that I missed or a small update somewhere that’s required.

  • Platform information:

    • Hardware: Intel Atom CPU Z3740D @ 1.33Ghz, 2GB RAM, 64GB
    • OS: 32-bit Windows 10 Home
    • Java Runtime Environment: jdk-8u152-windows-i586 | jre1.8.0_152
    • openHAB version: 2.1.0
    • Browser: Chrome ver 62
  • Issue:

    • I’m trying to get the feed from my D-link 2332L security camera to show up in openHAB. I first tried directly in HABpanel with no luck due to inability to send HTTP Basic Auth in the url as http://user:password@ip/ipcam/stream.cgi?nowprofileid=2 and http://user:password@ip/video/mjpg.cgi and http://user:password@ip/video2.mjpg, since browsers have recently blocked Basic Auth as part of the URL in this format, so none of these worked. Other variations with username and password as query parameters aren’t accepted by the camera (ex. http://ip/ipcam/stream.cgi?user=USERNAME&password=password&nowprofileid=2)

    • I then thought to first get it working on Basic UI after seeing HTTP Binding allowing for encoded auth header. However, when using it in an item and putting it on a Sitemap it doesn’t override the URL values of Image, Video or Webview, which it was noted should happen - unless it’s got to do with “some clients may not yet consider item”?

    • I’ve read through the following links but didn’t seem to find any working solutions: 1, 2

    • Is there a way I could use either of these two posts to make it work: 3, 4?

    • Additionally, there’s no way for me to either remove HTTP Auth requirement to view the security camera IP feed or create a guest user with no username/password. I disabled HTTPS to get this far, just in case.

  • Current configuration attempts:

    • Item configuration:

      • String Network_Device_CameraStream "Camera Stream" { http="<[http://192.168.1.112/ipcam/stream.cgi?nowprofileid=2{Authorization=Basic Base64encodedauth}]" }
    • Sitemap configurations:

      • Image/Video/Webview url="https://www.base64encode.org/assets/images/logo.png" item=Network_Device_CameraStream - item doesn’t override Image/Video/Webview url
      • Video url="http://192.168.1.112/ipcam/stream.cgi?nowprofileid=2{Authorization=Basic Base64encodedauth}" - Status code 500, Not a valid URI
      • http://192.168.1.112/ipcam/stream.cgi?nowprofileid=2{Authorization=Basic Base64encodedauth} - Status Code 403, Request is forbidden (considers it as no auth sent at all)
    • HTTP Binding version 1.10.0:

      • timeout - 5000
      • granularity - 1000
      • format - true

No issues showed up in logs, just the browser console responses included above against each attempt.

Among your attempts, I don’t see one to use the Video sitemap widget with the URL you want to use, like http://user:password@ip/ipcam/stream.cgi?nowprofileid=2. While the browser world is indeed deprecating the use of authentication inside URLs as you said, no browser is actually involved in handling that URL in this case. The proxy servlet inside openHAB/ESH will attempt to use the credentials similarly to how browsers have done so in the past.

Thanks for the quick response. I did in fact try that, but I keep getting net::ERR_ABORTED in the console and 403 Forbidden in the Network tab under headers. Is there an issue with the proxy, openHAB or something else?

Video url="http://user:password@192.168.1.112/ipcam/stream.cgi?nowprofileid=2"










Is it saying the remote address under General is 192.168.1.120:8080 (my openHAB machine:port) because of the proxy or an issue? And the Response Header is coming back as content-type text/html, too.

@aaronkhare
I know this thread is old but I noticed you are still stopping by the forum. I had the same issues as you outlined above and have solved them by the info in this thread. FFMPEG can take streams from many different formats and convert them into other formats as well as stripping the auth.

Hey @matt1, thanks for the share! Will take a look and see if it solves my issue. I kind of gave up after my last post above :tired_face:

Cheers!