I have an edge machine running Nginx as reverse proxy exposing an SSL connection to the Internet (on a non standard port) that proxies connection to my zoneminder docker which is working on port 80 without SSL.
Everything works fine but camera images. I get a broken link where camera image is supposed to be shown.
Digging in the problem, I realized that the IMG link that zoneminder places was in plain http (no https) and no port was placed.
I've studied the code and I finally found that in the includes path there is a Server.php file that holds two functions called Protocol and Port which mission is provide the correct "Protocol" and "Port" for the URL's.
So, to make things work I've made a couple changes: First, in Nginx I've added this two config lines to include in the HTTP Headers the original protocol and port the request had:
Code: Select all
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
Code: Select all
$headers = apache_request_headers();
if (isset($headers['X-Forwarded-Proto'])) {
return($headers['X-Forwarded-Proto']);
}
Code: Select all
$headers = apache_request_headers();
if (isset($headers['X-Forwarded-Port'])) {
return($headers['X-Forwarded-Port']);
}
I post this here in case it can help someone and it will be nice that this little change could be incorporated to the Zoneminder Code.
Thx
Chano.