logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reverse Proxy Help Needed
Author
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Wed 18 Oct '06 2:26    Post subject: Reverse Proxy Help Needed Reply with quote

Hi all. New to the site.

I have downloaded and installed 2.2.3 on a WinXP box. I want to use this box to serve various items. Some of the items include two ethernet cameras that live on my intranet. These cameras have a built in webserver that are setup to listen on port 80.

Since I only have one IP through my ISP I can currently only look at one camera at a time, opening port 80 for it in my router. What I am attempting to do, is setup a reverse proxy for both cameras, and have a link to them on my website.

I have things sort of working, as in, I can get to the cameras from the website. But, the video stream is broken. IE shows a blank box, and FireFox shows a broken image icon. Normally the video runs in some sort of ActiveX control.

So, I am not sure why the video stream does not work through the reverse proxy I have setup. If I go directly to the camera server, things work just fine.

Here is my config for the reverse proxy, which again seems to get me to the camera's server, just no video.

Code:

ProxyPass /backyard http://192.168.1.7
ProxyPassReverse /backyard http://192.168.1.7


I have also tried with forward slashes appended, with no change.

I know there is a lot here, but really appreciate the help.

Thanks!


Last edited by serveme on Wed 18 Oct '06 12:57; edited 1 time in total
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Wed 18 Oct '06 3:48    Post subject: Reply with quote

I had a bit of a brain fart. The camera is using cgi, so a reverse proxy needs to be setup for the cgi-bin directory. I got this to work for one of the cameras...

Code:

ProxyPass /backyard http://192.168.1.7
ProxyPass /cgi-bin http://192.168.1.7/cgi-bin
ProxyPassReverse /backyard http://192.168.1.7
ProxyPassReverse /cgi-bin http://192.168.1.7/cgi-bin


...but I also have a second that lives on another IP address. How can I setup either a second cgi-bin directory to use for the other camera, or somehow alias the directory?

If I do this...
Code:

ProxyPass /barn http://192.168.1.5
ProxyPass /cgi-bin http://192.168.1.5/cgi-bin
ProxyPassReverse /barn http://192.168.1.5
ProxyPassReverse /cgi-bin http://192.168.1.5/cgi-bin


Then of course the /cgi-bin is not mapped to the .5 IP but to the previous .7 IP.

I almost need a cgi-bin-backyard for the .7 and a cgi-bin-barn for the .5, so I can correctly reverse proxy them. Does this make sense, and how can I go about this?

Thanks!
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Thu 19 Oct '06 3:37    Post subject: Reply with quote

Can anyone help? Sad

Thanks.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 19 Oct '06 9:32    Post subject: Reply with quote

You need to set up barn2 and cgi-bin2 or something like that. That means you may have to change some action="/cgi-bin2/some.pl"
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Fri 20 Oct '06 6:57    Post subject: Reply with quote

..

Last edited by pnllan on Sat 21 Oct '06 19:22; edited 2 times in total
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Fri 20 Oct '06 12:33    Post subject: Reply with quote

James, can you elaborate a bit? I am an embedded developer, but not much of a web guy. Set up a few basic servers, nothing fancy. If you could provides some config details that would be great.

Someone, I am not sure where you post went... but.... I need to get to them from my work office. If I set it to anything but port 80 I have trouble getting to them.

Thanks again.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Fri 20 Oct '06 13:49    Post subject: Reply with quote

Code:

ProxyPass /barn http://192.168.1.5
ProxyPass /cgi-bin http://192.168.1.5/cgi-bin
ProxyPassReverse /barn http://192.168.1.5
ProxyPassReverse /cgi-bin http://192.168.1.5/cgi-bin


ProxyPass /barn2 http://192.168.1.7
ProxyPass /cgi-bin2 http://192.168.1.7/cgi-bin
ProxyPassReverse /barn2 http://192.168.1.7
ProxyPassReverse /cgi-bin2 http://192.168.1.7/cgi-bin


you know that you can't declare a path tow time / to two different servers. So you have to create two of them! If you do so, you have to edit the "action's" on the html pages where to send the data.
Works only if a script don't need both servers for execution.
I hope you got it. Sometimes my english is not the best Wink

So camera one useses barn and the second camera useses barn2
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Fri 20 Oct '06 18:53    Post subject: Reply with quote

James, so I need to create a cgi-bin2 directory, correct? So I then would have cgi-bin for the camera 1 , and cgi-bin2 for camera 2, yes?

I am a little puzzled by the "actions" thing, can you give any more information on this?

Thanks for the help, I appreciate it.
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Tue 24 Oct '06 14:12    Post subject: Reply with quote

Still no luck with this... Rolling Eyes anyone else have any ideas?

Thanks!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Tue 24 Oct '06 14:21    Post subject: Reply with quote

Can you post a short example script of the two cams else I can only guess why it doesn't work yet.

If you have only one cam, does it run than?
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Wed 25 Oct '06 13:59    Post subject: Reply with quote

James,

This is not exactly a "short" example... but I was not sure what you were interested in. Also, this is captured by right clicking and selecting "view source" from IE. I do not have access to the internals of the camera (at least that I know of), so I can not get to the actual running code.

Thank you again for the help.

*edit*... James, and yes, I can get to one of the cameras via Apache and the reverse proxy. But when I try to get to the second, it wants to redirect the cgi directory scripting to the first. So what I end up getting is the page from the second camera, but the image data from the first. Make sense? This is why I think I need two cgi-bin directories as described above. So I can "aim" cgi-bin at cam1 and "cgi-bin2" to cam2.

Thanks! Smile

Code:

<html>
<head>
<title>Network Camera </title>
<script language="JavaScript">
<!--
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) {
  var win = window.open(theURL,winName,features);
  win.focus();
}
//-->
</script>
<style type="text/css">
<!--
  a { color:#FFFFFF; text-decoration: none; }
  a:hover { color:#FFFFFF; text-decoration: underline; }
  .genFont{font-family:verdana,sans-serif;font-size:13px;color:#FFFFFF;}
  .selFont{font-family:verdana,sans-serif;font-size:11px;color:#FFFFFF;}
  .cpqFont{font-family:verdana,sans-serif;font-size:11px;color:#000000;}
  .intext{font-family:Courier, Monaco, Monospace; font-size:10px; text-align:left; color:#000033}
//-->
</style>
<script language="JavaScript">
<!--
function SubmitPanspeed(selObj) {
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/control.cgi?cam=1&panspeed=' + (i-5)
}
function SubmitTiltspeed(selObj) {
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/control.cgi?cam=1&tiltspeed=' + (i-5)
}
function SubmitPreset(selObj) {
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/recall.cgi?cam=1&recall=' + selObj.options[i].text
}
//-->
</script>
</head>
<body bgcolor="#000000" background="/back.gif">
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr><td>
  <table width="720" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width=160 height=60><a href="http://" target="_blank"><img src="/logo.gif" border=0 vspace=10></a></td>
    <td align=center><font color="#FFFFFF"><b><font size="4" face="verdana, Helvetica, sans-serif">
      Network Camera </font></b></font></td>
   <td colspan=4>&nbsp;</td>
  </tr>
  <tr height=25>
    <td>&nbsp;</td>
    <td align=center>
      <span class="selFont"><B>Quality:</B></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=1&size=2">Medium</a></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=2&size=2">Standard</a></span>
      <span class="selFont">   |   </span>
      <span class="genFont"><u>Good</u></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=4&size=2">Detailed</a></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=5&size=2">Excellent</a></span>
      <span class="selFont">   |   </span>
    </td>
    <td colspan=3><span class="selFont">&nbsp;&nbsp;&nbsp;&nbsp;Digital Output</span></td>
  </tr>
  <tr height=25>
    <td>&nbsp;</td>
    <td align=center>
      <span class="selFont"><B>Size:&nbsp;&nbsp;</B></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=3&size=1">Half </a></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=3&size=4">Half x 2</a></span>
      <span class="selFont">   |   </span>
      <span class="genFont"><u>Standard</u></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=3&size=5">Standard x 2</a></span>
      <span class="selFont">   |   </span>
      <span class="selFont"><a href="/index.html?cam=1&quality=3&size=3">Double</a></span>
      <span class="selFont">   |   </span>
    </td>
    <td width="300">&nbsp;&nbsp;&nbsp;<input type="button" class=cpqFont style="width:50px" name="do1open" value="Open"

onClick="parent.retframe.location.href='/cgi-bin/setdo.cgi?do1=o'">
    <input type="button" class=cpqFont style="width:50px" name="do1close" value="Close"

onClick="parent.retframe.location.href='/cgi-bin/setdo.cgi?do1=c'"></td>
    <td width="60">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td>
      <table width=100 border=0 cellpadding=0 cellspacing=0>
      <tr><td height=5>&nbsp;</td></tr>
      </table>
    </td>
    <td align=center>
      <table width=420 border=0>
      <tr><td height=5>&nbsp;</td></tr>
      <tr><td align=center>
      <script language="JavaScript">
      <!--
      if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC"))
      {
        document.write("<OBJECT ID=\"MjpegControl\" WIDTH=352 HEIGHT=240");
        document.write(" CLASSID=\"CLSID:EAA105FE-7BBD-4196-8B96-D46743894195\" ");
        document.write(" CODEBASE=\"/plugin/mjpegcontrol.cab#version=2,0,0,13\">");
        document.write("<PARAM NAME=\"VSize\" VALUE=\"2\">");
        document.write("<PARAM NAME=\"Url\" VALUE=\"/cgi-bin/video.jpg");
        document.write("?cam=1&quality=3&size=2\">");
        document.write("<PARAM NAME=\"PtzUrl\" VALUE=\"/cgi-bin/control.cgi?cam=1\">");
        document.write("</OBJECT>");
      }
      else
      {
        document.write("<img width=352 height=240 src=\"/cgi-bin/video.jpg?cam=1&quality=3&size=2\">");
      }
      //-->
      </script>
      </td></tr>
      </table>
    </td>
   <td colspan=2>
       &nbsp;&nbsp;&nbsp;<input type="button" class=cpqFont style="width: 104; height: 22" name="snapshot" value="snapshot"

onClick="MM_openBrWindow('/cgi-bin/video1.jpg?size=2&quality=3','JPEGsnapshot','width=370,height=320')">
   </td>
  </table>
</td></tr>
</table>
</body>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Wed 25 Oct '06 14:11    Post subject: Reply with quote

You see that there is /cgi-bin/ as location.href from javascript or ActictivX Object. For Cam 1 it should work, shouldn't it?
For the second cam you have to modifie your html source and change /cgi-bin/ to cgi-bin2/

Hope you got it!
Back to top
serveme



Joined: 18 Oct 2006
Posts: 8

PostPosted: Wed 25 Oct '06 18:03    Post subject: Reply with quote

Yes, it works for cam1.

I don't have access to the source code, or I would change the script directory path... Guess I am out of luck?
Back to top


Reply to topic   Topic: Reverse Proxy Help Needed View previous topic :: View next topic
Post new topic   Forum Index -> Apache