YawCam Behind Apache Proxy

Questions? Suggestions? Need help? Talk about anything related to Yawcam...
Post Reply
AlanH
Posts: 6
Joined: Thu Apr 13, 2006 9:15 pm

YawCam Behind Apache Proxy

Post by AlanH »

First of all, fantasic product in Yawcam. Really top-notch stuff.

At home I have a single public IP address. On this address I currently run a Linux server with an Apache web server on it. For those of you who may be unfamiliar, Apache has the ability to proxy requests sent to it and get the information from another server.

For example, if you hit the web server with a URL like the following: http://internet.server.com, Apache loads the default page like usual. However, say I have a proxy directive to point requests to the Apache server's subdirectory of "video" to a Windows IIS web server on my private network. So, requests to http://internet.server.com/video actually come from a Windows machine on my network but that is transparent to the person hitting my server. It appears to be served up by the Apache server on the public address.

What the HECK does this have to do with Yawcam, you ask?

Well, I'd LIKE to have it such that my webcam running on my WindowsXP machine can be accessed from the internet simply by passing the proxy directive through my Apache server. I keep running into NullPointerException due to the fact that it can't find the Yawcam.class file.

SO, my Apache configuration would look something like this:
ProxyPass /webcam http://mywinxppc:8081

So, people accessing the /webcam directory on my webserver would actually be getting requests passed through to my WinXP. I plan on doing this through an IFRAME in order to wrap my normal web page template around the streaming content. (I plan on PROUDLY including the Yawcam name and link!)

I guess my question boils down to the three following points:
1. Does anyone know if this will actually work?
2. Can I do this with a subdirectory calling the Java app?
3. With the "server" and "port" information, does the applet expect values that reflect the server the Yawcam software is actually running on, or does it need to be configured to reference the address that a web browser THINKS it's running on?

Any help with this would be appreciated. And if, by some miracle, I figure this out on my own, I'm happy to post instructions here.

Thanks!

Alan
malun
Site Admin
Posts: 1593
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

I'm not sure how and if this will work. But one thing I know is that the applet can only open a connection to the server it was downloaded from. So, if the proxy is transparent I guess you'll have to change the host so it points to the appache server's address. You can do this by clicking "settings -> edit settings -> stream" and then mark the "advanced" check box and type in your apache server's host address in the "force public ip" field.

A second thing I guess you will have to do is to forward a port on your linux machine where apache is running. Because the applet will now try to connect to your linux machine on the specified port. So, forward the port (default is 8081) on your linux macine to your windows machine where Yawcam is running.

Let us know how it goes!

/malun
AlanH
Posts: 6
Joined: Thu Apr 13, 2006 9:15 pm

Post by AlanH »

Magnus,

Thanks for the suggestions and for taking the time to reply. I had gone through most of that already.

I've decided to take a different approach: virutal hosts. Basically, I setup my Apache server to proxy/redirect all requests for the webcam (via a seperate URL) to my Yawcam PC using Apache's virutal hosts functionality.

Basically, here's what I did: requests to my.webserver.com go to my Linux box. Requests for my.webserver-webcam.com get redirected to my Windows PC with the Yawcam. I then setup Yawcam to say that it's running on "my.webserver-webcam.com:80".

This appears to be working... Mostly. Not being a Java guy, I don't what this error means, but it now happens every time I try and connect to my.webserver-webcam.com. Here's the output from the Java console:

Code: Select all

Java Plug-in 1.5.0_06
Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
.
.
.
No offlineImage supplied...
Zoom enabled...
Host: my.webserver-webcam.com:80
Will look for UDP packs on: localhost:1568
Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
The Java window has all of the Zoom controls and everything, like the applet loaded, but it's just the stream that dies.

I've tried this from multiple PCs inside and outside of my network (across the Internet) just to make sure it wasn't something funky on my test PC. To verify the Yawcam app was still working, I loaded the local page from a different PC (10.x.x.1/local.html) and the app loads fine.

So, I don't know what this error means, but it occurs each time.

If it weren't for the fact that it happens even locally on my network, I'd think that maybe my firewall (Linux/IPTables) is blocking the UDP traffic from the webcam machine to the client. I'll double-check that, but any suggestions or information anyone wants to throw out there would be lovely.

Thanks again!
malun
Site Admin
Posts: 1593
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

Hmm... The applet runs out of memory. Strange.

Does the applet show images a while before it stops, or is it white all the time?

/malun
AlanH
Posts: 6
Joined: Thu Apr 13, 2006 9:15 pm

Post by AlanH »

Sorry for the delay... I was out of town this past week.

No, it never shows images. However, the applet loads far enough to where right-clicking in the applet window does show the various applet options: zoom, pan, protocol, etc. But no images ever display. The actual applet window shows "Loading..." I had to get the error out of the Java console.

Maybe with all of this redirection, is there a possibility I've created some sort of infinite loop that causes the app to use up available memory space? I have my suspicions (though I have no concrete evidence to back it up) that the memory error is bogus. Something else is happening and that's the closest that the client/applet can come to an explaination for whatever it has encountered. That is just a hunch, though.

Still investigating...

Thanks again for taking the time to respond and ponder this.

Alan
malun
Site Admin
Posts: 1593
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

Yes, the out of memory error is really strange.
Any progress with the investigation?

/malun
AlanH
Posts: 6
Joined: Thu Apr 13, 2006 9:15 pm

YAWCAM Behind Apache Proxy

Post by AlanH »

Malun,

Just wanted to let you know that 0.3.0 fixed this issue. I upgraded and everything worked as I was trying to get the older version to do. I know it's been ages since I've posted to this thread, but I kept trying things to see if they'd work. Nothing ever did. The new version made everything work as I had wanted it to before.

Thanks so much for your dedication and efforts in making this a really awesome webcam solution! Keep up the excellent work!

Alan
malun
Site Admin
Posts: 1593
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

Great!
Thanks for letting us know!

/malun
Post Reply