Hey Michel,
HTTP proxies are always the "fun" kind of confusing, so I'm not surprised you're running into some issues here.
I'll try and give you some pointers, but I'll be honest in that I usually mess this up until I get it right again as well.
This is a Docker compose booting MistServer, Prometheus, Grafana and settings for Caddy are available as well. If you're just interested in a working SSL connection chances are copying this will be easy as it's made to do exactly that. In order to use Caddy with this docker compose file you do need to edit the
env.example Fill in the domain & remove the # in front of
caddy. You'll want to edit the
docker compose file as well.
So a few things to keep in mind:
- HTTPS pages should only ever attempt to open HTTPS video links
- HTTP pages should only ever attempt to open HTTP video links
- If you notice MistServer can serve embed pages, or .html links, but not in the configuration there's 1 of 2 things going on:
1. Your MistServer configuration file saved the httpUrl as something invalid. This can be checked by editing the config and looking for a `"ui_settings": {"HTTPUrl":"ADDRESSHERE:4242",} field. Then correct/delete this. It saves the first time you access MistServer over the interface and it can very well be locked into an address only available for one specific device.
2. Your MistServer configuration is not aware of its HTTP endpoints apart from the port it's got open. This could mean the X-Mst-Path header isn't passed on correctly, the easiest fix is to set a Public Address telling MistServer where all its HTTP(S) addresses are.
- If your Docker container address changes, these need changing as well
If MistServer is the main purpose of the machine, I would recommend binding to --network=host, this way you can just use the address of the machine and not the Docker container. Though this very much depends on what else you're running.
Either way I think the easiest fix for you would be doing the exact same thing you do for the reverse proxy, but add the interface. This enables HTTPS for the interface and would allow the working embed links to be used in the interface instead of generating CORS errors.
If I'm looking at your settings the following will probably be correct:
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Mst-Path "$scheme://$host/mistserver";
}
Now a thing to keep in mind is that this should mean your docker running MistServer can be reached as `172.30.0.1`.
If the setting is correct you should be able to visit
https://mistserveraddress/mistui/ and receive the interface over HTTPS. This one should be able to preview the streams using the HTTPS reverse proxy you've got working already.
Note that we don't necessarily recommend opening the interface for untrusted connections or to the public internet. MistServer runs pretty deep on a server and it would provide people root access to your server if they manage to log in.
The X-Mst-Path "should" auto fill the Public address fields in the HTTP protocol whenever someone connects, meaning you don't have to set the Public address page. If you notice the HTTP is working, but the SSL version of the interface is not, you'll want to add both the HTTP and the HTTPS address to the public address.
The Public address setting is basically telling MistServer where its HTTP addresses are, if you'd only fill in the HTTPS one it will only work for that address, so HTTP will no longer work.
You know you've got the right address if you get an unsupported media type page:
Unsupported Media Type
The server isn't quite sure what you wanted to receive from it.
Just try and open it in the browser, if you see a page displaying this you have reached a MistServer HTTP endpoint.