http and https

Support and queries relating to all previous versions of ZoneMinder
Locked
dbosso
Posts: 23
Joined: Thu Jul 21, 2005 8:21 pm
Location: Goleta, California

http and https

Post by dbosso »

I just figured out why my streaming was mostly broken after upgrading from 1.21.0 to 1.21.3.

I've got a permanent redirect in apache for the http vhost of my zoneminder install going to https. This seems to work fine, but for some reason zoneminder creates all the streaming links with http URLs which then fail. I've adjusted apache settings so that cgi-bin is not redirected to https and things are working.

Was something changed between 1.21.0 and 1.21.3 that would account for this?

-David
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I will check this. I think someone reported an issue with using WMP which failed to find the stream unless it was a full url, so I may have added that on. I'll make it configurable in the next release if it's going to cause problems.

Phil
dbosso
Posts: 23
Joined: Thu Jul 21, 2005 8:21 pm
Location: Goleta, California

Post by dbosso »

Thanks. What you probalby want is a preference for a base url for zoneminder. Then you can also handle the non-standard port case.

-David
dreadlocks
Posts: 16
Joined: Tue Nov 30, 2004 9:53 am
Contact:

Post by dreadlocks »

Until the next version you can fix this by editing zm_funcs.php

Code: Select all

$stream_src = "http://".$_SERVER['HTTP_HOST'].ZM_PATH_ZMS;
and change the http:// to https://
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Or you can make it so that the script is a bit smarter and able to handle both:

This one usualy works the best.

Code: Select all

if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ) {
     $PROTOCOL = 'https';
} else {
     $PROTOCOL = 'http';
}
$sream_src = $PROTOCOL . '://' .$_SERVER['HTTP_HOST'].ZM_PATH_ZMS;
or another way might be (and my pesonal favorite):

Code: Select all

if ( isset($_SERVER["SERVER_PROTOCOL"]))
{
     list($PROTOCOL, $version) = explode('/', $_SERVER["SERVER_PROTOCOL"]);
}
$sream_src = $PROTOCOL . '://' .$_SERVER['HTTP_HOST'].ZM_PATH_ZMS;
But this last one may give you mixed protocols

Regards,
Cordel
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Added to bug list. I'll put something in the next release.

Phil
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Ideally would be create a variable in zm_config.php ( Might be there but I haven't looked yet) for

Code: Select all

if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ) {
     $PROTOCOL = 'https';
} else {
     $PROTOCOL = 'http';
}
define('ZM_URL', $PROTOCOL . '://' .$_SERVER['HTTP_HOST']); 

Then use this variable in zm_funcs.php

Regards,
Cordel
snei
Posts: 1
Joined: Sat Mar 04, 2006 10:05 pm

Post by snei »

*edit* :oops:
Locked