Koozali.org: home of the SME Server

Proxypass issue with zoneminder [SOLVED]

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Proxypass issue with zoneminder [SOLVED]
« on: August 26, 2008, 04:36:23 PM »
I have two SME 7.3. One as server-gateway (LAN IP: 192.168.0.1) and the second server is server-only with an IP 192.168.0.2.
Main server (server and gateway) connect to internet, and not have enabled internal LAN DHCP server, so the server-only has a fixed IP.

At the server only I have a FQDN pepe.com and added the directive proxypass as say at the wiki in the main server. So, when I try to access at internet the domain pepe.com run all ok, because pepe.com is proxied to the server-only 192.168.0.2.

I have installed the server -only for the unique purpose to run as video machine with zoneminder. So, when I access to pepe.com/zm run all ok, but not for video stream nor stills. If I see the image properties I see they come from:

http://192.168.0.2/zm/xxxxxxxx.jpg

and not from:

http://pepe.com/zm/xxxxxxxx.jpg

I don't know if this is a zoneminder issue, and if it is posible to fix adding or changing some proxy directive at the main server.

Thank you
« Last Edit: August 29, 2008, 07:06:31 PM by Normando »

Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #1 on: August 26, 2008, 05:35:05 PM »
You need DNS Record setup for it??

zm.pepe.com

http://pepe.com/zm/xxxxxxxx.jpg

Will then be

http://zm.pepe.com/xxxxxxxx.jpg

See if

http://zm.pepe.com/xxxxxxxx.jpg

works without the record.

http://www.zm.pepe.com/xxxxxxxx.jpg

Obviously won't work without the record.

Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #2 on: August 26, 2008, 05:43:17 PM »
Also you'll need (forgot to mention)

Code: [Select]
db domains set proxypassdomain.com domain
db domains setprop proxypassdomain.com Nameservers internet
db domains setprop proxypassdomain.com ProxyPassTarget http://xxx.xxx.xxx.xxx/
db domains setprop proxypassdomain.com TemplatePath ProxyPassVirtualHosts
signal-event domain-create proxypassdomain.com

for external  access.

http://zm.pepe.com/xxxxxxxx.jpg

Should work internal only.

Assume you used 'Remote' option Hostnames & Address

http://zm.pepe.com/xxxxxxxx.jpg
&
http://www.zm.pepe.com/xxxxxxxx.jpg

Will work externally when all is well with the code above.


Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #3 on: August 26, 2008, 06:01:45 PM »
Might save you some time
Code: [Select]
db domains set zm.pepe.com domain \;
db domains setprop zm.pepe.com Nameservers internet;
db domains setprop zm.pepe.com ProxyPassTarget http://192.168.0.2/;
db domains setprop zm.pepe.com TemplatePath ProxyPassVirtualHosts;
signal-event domain-create zm.pepe.com;
db domains show


Copy and paste the entire code to command line, be sure to get the last line trailing space
which includes the CR & LF before it.

Note: Run code above on primary server, should not need any Port Forward's

edit:fix some typo's & added note
« Last Edit: August 26, 2008, 06:23:41 PM by electroman00 »

Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #4 on: August 26, 2008, 06:11:48 PM »
DNS Host record will then be

*.zm.pepe.com & TLD pepe.com IP

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Proxypass issue with zoneminder
« Reply #5 on: August 26, 2008, 08:29:26 PM »
Hi electroman00

Thank you for all your replies.

I have configurated proxy as you suggest me in your post, but without success

I can't understand why I see zoneminder interface correctly, also a few interface images are showed correctly, but not show the video capture because it have an address based on the server IP and not in the domain name.

A real example:
Zoneminder has two small arrow keys, and this is the url:

http://www.pepe.com.ar/zm/graphics/seq-u.gif

but the video capture or stills has this url:

http://192.168.0.2/zm/cgi-bin/zm/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=5&rand=1219775241

instead of

http://www.pepe.com.ar/zm/cgi-bin/zm/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=5&rand=1219775241

This is the issue, ZM generate video and stills with the server IP insead of domain from where I see it.

Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #6 on: August 27, 2008, 01:53:45 AM »
No access from here...
Firefox can't find the server at www.pepe.com.ar.

either to

http://www.pepe.com.ar/zm
or
http://www.pepe.com.ar

http://www.pepe.com, Yes but a parked page.

If you would post results of

db domains show     primary & secondary server

Thinking here, you might have to change

db domains setprop zm.pepe.com ProxyPassTarget http://192.168.0.2/;

to

db domains setprop zm.pepe.com ProxyPassTarget http://192.168.0.2/zm;
signal-event domain-create zm.pepe.com;
db domains show

Not sure it will take it like that, may not like the zm on the end .....I've never tried that.
I only have one server up right now so I can't test it.

Someone else might know...

Can't hurt to try though, can always set it back.

BTW the zm in zm.pepe.com is the hostname you could/should enter for Hostnames and Address else
you would need to change the code and DNS record to reflect your change.

Not sure you noticed or knew that.
« Last Edit: August 27, 2008, 04:04:09 PM by electroman00 »

Offline electroman00

  • *****
  • 491
  • +0/-0
Re: Proxypass issue with zoneminder
« Reply #7 on: August 27, 2008, 05:23:45 PM »
I can't understand why I see zoneminder interface correctly, also a few interface images are shown
correctly, but not show the video capture because it have an address based on the server IP and not in the domain name.
A real example:
Zoneminder has two small arrow keys, and this is the url:
http://www.pepe.com.ar/zm/graphics/seq-u.gif
but the video capture or stills has this url:
http://192.168.0.2/zm/cgi-bin/zm/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=5&rand=1219775241

That's either a default zm configuration or a zm host.conf issue.

It should work with both, since it doesn't....

What does the ZM config look like in host.conf 

To get the pri proxy to work....you may have to append zm to

db domains setprop zm.pepe.com ProxyPassTarget http://192.168.0.2/zm;

As I said, I'm not sure that will work, never tested.

zm here

http://www.pepe.com.ar/zm/graphics/seq-u.gif

refers to the  ZM Virtual Web on the zm server.

zm here

http://www.zm.pepe.com.ar/zm/graphics/seq-u.gif

is the proxy host on the primary server pointing to the ZM server.

The proxy host can have any desired name, I just used zm as an example and
I'm realizing it may be confusing things here.
I would say I'm somewhat confused due to the lack of config info.

Posting       db domains show     primary & secondary server
&
Zm's host.conf section

Allows all to sync up with each other.

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Proxypass issue with zoneminder
« Reply #8 on: August 29, 2008, 05:31:30 AM »
Thanks electroman00 for your effort.

Finally I found a solution. And then I was found the answer at the ZM forums  :-(

In the file zm.php (or symlinked index.php) you have found:

Quote
define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] );

To fix I was changed to:

Quote
define( "ZM_BASE_URL", $protocol.'://www.pepe.com.ar' );

But the REAL fix is to change to:

Quote
define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_X_FORWARDED_HOST'] );

or better

Quote
if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
        define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] );
}
else
{
        define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_X_FORWARDED_HOST'] );
}

as say at the ZM forums:
http://www.zoneminder.com/forums/viewtopic.php?p=34435#34435

Thanks you  :pint:

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Proxypass issue with zoneminder
« Reply #9 on: August 29, 2008, 06:51:51 PM »
Moving this topic to the SME 7.x contribs forum, it is more appropriate there. Thanks!
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!