OpenWebIf and caddy

Hello,

OpenWebIf is a web interface for Enigma2 based set-top boxes (STBs) which can be useful in case you want to watch your TV while… you are not on your couch :slight_smile:

This system basically offer access to your decoder’s settings and list of channels (bouquets) on port 80 (HTTP) and on port 443 (HTTPS).

This system also offers the possibility to stream the channels as it is (on port 8001) and even to stream them transcoded (on port 8002).

To stream or decode the system basically creates a .m3u8 file (which needs to be read for example by VLC) similar to the following:

#EXTM3U 
#EXTVLCOPT--http-reconnect=true 
#EXTINF:-1,CNN HD
#EXTVLCOPT:program=7801
http://[ip_decoder]:8001/1:0:1:F49:1470:13E:820890:0:0:0:

I have been able (thanks to the excellent help of @Whitestrake) to understand how to create a reverse proxy to access OpenWebIf interface (both in http and https), however I would like to know if it would be also possible to use the same reverse proxy to also tunnel connections to/from ports 8001 and 8002.

Here is the caddy.conf that works to reach OpenWebIf:

owi.domain.com {
  proxy / https://192.168.1.3 {
    transparent
    websocket
    insecure_skip_verify
  }
}

Would this be possible at all? The obvious advantage would be that you do not need to open multiple ports on your router.

Thank you!

Looks like it’s HTTP traffic. Should be doable with the basic format:

http://example.com:8001 {
  proxy / [Enigma-2]:8001
}

http://example.com:8002 {
  proxy / [Enigma-2]:8002
}

Alternately, you could look into the net server type to proxy the TCP traffic.

https://caddyserver.com/docs/net

This might be difficult unless you can configure OpenWebIf to generate a .m3u8 file with a different target port. You’d also have to key the sites off the hostname, e.g.

http://raw.example.com {
  proxy / [Enigma-2]:8001
}
http://transcoded.example.com {
  proxy / [Enigma-2]:8002
}

And the .m3u8 files would have to reflect that, I expect.

Thank you Matthew,

When you click on a channel, OpenWebIf already puts in the m3u8 file the correct name domain. So, if I connect to via owi.domain.com, the m3u8 will be something like:

#EXTM3U 
#EXTVLCOPT--http-reconnect=true 
#EXTINF:-1,CNN HD
#EXTVLCOPT:program=7801
http://owi.domain.com:8001/1:0:1:F49:1470:13E:820890:0:0:0:

As far as I understand this is already a good starting point.

Then, looking at your suggestions, the first option would entails opening the two ports on the router, which does not entirely accomplish the task.

In relation to net plugin, even reading at the documentation, I am not sure to understand how it works and could possibly work in this case.

In relation to change how the m3u8 is generated, I have opened an Issue report on gitHub [1] to see if and how this could be done.

Meanwhile if you think there is still something which Caddy could do, I would be really interested to ear.

Thanks a lot!

[1] Reverse proxy (also for raw and transcoded streams) · Issue #826 · E2OpenPlugins/e2openplugin-OpenWebif · GitHub

Well, you really need to achieve two things; firstly, you have to be able set the m3u8 domain to an arbitrary value, otherwise you won’t be able to control where it points anyway and the exercise is moot because it’ll always use the default.

Then, you need to point it at Caddy and configure Caddy in such a way that it can tell how to direct the traffic to the correct service (either web, raw stream, or transcoded stream). Caddy’s methods of doing so are limited to variables in the request, such as parts of the URL. The simplest ways are:

  1. Varying the hostname, like my example above;
  2. Varying the port, which you’ve said is not ideal;
  3. Varying some part of the URI

So, while I’m unfamiliar with the program, if there’s some part of /1:0:1:F49:1470:13E:820890:0:0:0: that always appears in a raw stream, you could test for it and proxy to the raw stream port based on that.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.