giopas
(giopas)
November 22, 2022, 8:31am
1
1. Output of caddy version
:
Caddy 2.6.2
2. How I run Caddy:
a. System environment:
Raspberry PI4 with Raspian
b. Command:
caddy start --config /etc/caddy/Caddyfile
c. Service/unit/compose file:
none
d. My complete Caddy config:
{
log {
output file /home/admin/Caddy2-logs/caddy2.log
}
email admin@example.com
}
openwebif.example.com {
log {
output file /home/admin/Caddy2-logs/openwebif.log
}
encode gzip
header Strict-Transport-Security max-age1536000;
reverse_proxy http://192.168.1.10:80
}
streaming.example.com {
log {
output file /home/admin/Caddy2-logs/streaming.log
}
encode gzip
header Strict-Transport-Security max-age1536000;
reverse_proxy http://192.168.1.10:8001
}
3. The problem I’m having:
I can access both subdomains, but the issue is that openwebif creates an m3u8 file is in the following format:
#EXTM3U
#EXTVLCOPT –http-reconnect=true
#EXTINF:-1 ,CNN HD
#EXTVLCOPT:program=7801
http://openwebif.example.com:8001 /1:0:1:F49:1470:13E:820890:0:0:0:
I would like to have it redirected or renamed to:
http://streaming.example.com /1:0:1:F49:1470:13E:820890:0:0:0:
Is it possible to do so? How to do so?
I tried in the past (see below, with Caddy1), but I still cannot make my head around this.
Thanks
6. Links to relevant resources:
opened 12:42PM - 17 Jul 18 UTC
closed 05:08PM - 08 Dec 21 UTC
Hi folks,
I am running OWIF 1.3.3 on my Open Black Hole and I would like to u… se it behind a reverse proxy in order to have just one port open in the firewall.
In particular, I am using Caddy [1] and this is the configuration which offers plain access to the WebUI:
```
owif.domain.com {
proxy / https://192.168.1.100 {
transparent
websocket
insecure_skip_verify
}
}
```
The problem however arises in case I want to actually stream raw or transcoded streams as I would need to also open port 8001 and 8002.
As far as I can see the m3u8 file is in the following format:
> #EXTM3U
> #EXTVLCOPT--http-reconnect=true
> #EXTINF:-1,CNN HD
> #EXTVLCOPT:program=7801
> http://owif.domain.com:8001/1:0:1:F49:1470:13E:820890:0:0:0:
However, would not be possible to use the same (80 or 443) port to stream the content. Maybe just a flag `raw` or `transcoded` would determine the quality of the streaming?
This, in addition to html5 transcoding [2], would dramatically improve the security and use case of this service.
Do you have any idea on how to achieve this? Is there maybe other plugin which would serve this purpose?
Thanks
[1] https://github.com/mholt/caddy
[2] https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/issues/723
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 …
Since you’re running on a Debian-based distro, I strongly recommend running Caddy as a systemd service instead of with caddy start
.
That’s invalid. I think you meant to include a =
in there between max-age
and the number.
You could do this with this plugin:
But the best solution will definitely be to fix it at the source. Could you run a script to update the files openwebif generates to fix them?
1 Like
giopas
(giopas)
November 22, 2022, 11:58pm
3
Thank you Francis.
I read about the documentation you pointed to me, bit honestly I feel lost on how and where it would need to be implemented.
Unfortunately, even looking at openwebif GitHub, it seems there is no interest to change behavior. Possibly because it is a tool made for local cast/streaming (or most people streams enigma2 through Plex using various middleware and Plex, which seems overkilling to me)…
Are there easy practical examples I can refer to understand how the module would work?
Thanks again
Have you read the README?
Please explain what you don’t understand.
giopas
(giopas)
November 23, 2022, 8:55pm
5
Sure, I did. But honestly I do not know where to start when I read:
This module has Caddyfile support. It registers the replace directive. Make sure to order the handler directive in the correct place in the middleware chain
How to install/enable this module?
Where is “the correct place” in my Caddyfile?
Should it be in the section of streaming.example.com or decoder.example.com ?
Should I basically use regex to change “decoder.example.com:8001 ” to “streaming.example.com ”?
Apologies for the dumb questions.
Thanks
1 Like
Either with xcaddy
or by grabbing a build from Download Caddy .
giopas:
Where is “the correct place” in my Caddyfile?
As described in the README at GitHub - caddyserver/replace-response: Caddy module that performs replacements in response bodies you need to set the order
for the replace
directive, then you can use it anywhere within your site blocks.
You put it in whichever site responds with the content you want to transform.
Probably? Try it out and play with it.
system
(system)
Closed
December 22, 2022, 8:31am
7
This topic was automatically closed after 30 days. New replies are no longer allowed.