VNC and Apache Reverse Proxy

Christopher Tesla christophert "at" cellulargenomics.com
Fri, 11 Jan 2002 16:17:50 +0000


Thanks to Michael Ossmann for the last response on this issue.  I have since
made some more discoveries, and of course that leads to more questions.

I temporarily switched to using the rewrite mod instead, since I can log all
redirects.  I am also using Netscape, since I can get the Java Console to give
me debug info.  I use this code in Apache (which is running on server
"apacheserver"):

     RewriteEngine on
     RewriteLog "C:/rewritelog.txt"
     RewriteLogLevel 3
     RewriteRule	/vncserver	http://vncserver:5800 [P]

When I browse to http://apacheserver/vncserver I get the grey screen and the
"vncviewer not loaded" error.  This is what the Java Console tells me:

Netscape Communications Corporation -- Java 1.1.5 Type '?' for options.
Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
java.io.IOException: <null>
   at netscape.net.URLConnection.connect(Compiled Code)
   at netscape.net.URLConnection.getInputStream(Compiled Code)
 * at netscape.applet.AppletClassLoader.grabArchiveFile(Compiled Code)
   at netscape.applet.AppletClassLoader.openArchive(Compiled Code)
   at netscape.applet.AppletClassLoader.openArchive(Compiled Code)
   at netscape.applet.AppletClassLoader.<init>(Compiled Code)
   at netscape.applet.AppletClassLoader.getClassLoader(Compiled Code)
   at netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled
Code)
   at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
   at java.awt.EventDispatchThread.run(Compiled Code)
   at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
Code)
 # Unable to load archive http://apacheserver/vncviewer.jar:
java.io.IOException: <null>
 # Applet exception: class vncviewer could not be loaded

So Michael was right, the viewer is trying to load the .jar file from the
Apache server and not the vnc server.  This is what my redirect log shows (I
chopped off all the time/date info):

  [rid#5cc4f8/initial] (2) init rewrite engine with requested uri /vncserver
  [rid#5cc4f8/initial] (3) applying pattern '/vncserver' to uri '/vncserver'
  [rid#5cc4f8/initial] (2) rewrite /vncserver -> http://vncserver:5800
  [rid#5cc4f8/initial] (2) forcing proxy-throughput with
http://vncserver:5800
  [rid#5cc4f8/initial] (1) go-ahead with proxy request
proxy:http://vncserver:5800 [OK]
  [rid#5cc4f8/initial] (2) init rewrite engine with requested uri
/vncviewer.jar
  [rid#5cc4f8/initial] (3) applying pattern '/vncserver' to uri
'/vncviewer.jar'
  [rid#5cc4f8/initial] (1) pass through /vncviewer.jar
  [rid#5cc4f8/initial] (2) init rewrite engine with requested uri
/vncviewer.class
  [rid#5cc4f8/initial] (3) applying pattern '/vncserver' to uri
'/vncviewer.class'
  [rid#5cc4f8/initial] (1) pass through /vncviewer.class

So my browser is looking for the vncviewer.jar and vncviewer.class files, but
can't find them.  I need to tell the Apache server to redirect queries for
these two files...but I don't know where to send them!!  I have searched the
vncserver repeatedly (again, a W2K Server) and there are no files called
vncviewer.jar and vncviewer.class on any of the hard drives.  Where do these
files sit on a Windows server?  I tried adding these lines to the redirect
code:

     RewriteRule	/vncviewer.jar	http://10.1.1.5:5800/vncviewer.jar [P]
     RewriteRule	/vncviewer.class	http://10.1.1.5:5800/vncviewer.class [P]

And presto I get the VNC login window!  I enter the password for the server
into the field and click OK.  The browser status window shows "Applet
vncviewer running", but nothing happens.  After nearly two minutes I finally
get an error in the browser window that says "java.net.SocketException: Socket
closed".  The Java Console gives me this:

java.net.SocketException: Socket closed
   at java.net.SocketInputStream.read(Compiled Code)
   at java.io.BufferedInputStream.fill(Compiled Code)
   at java.io.BufferedInputStream.read(Compiled Code)
   at java.io.DataInputStream.readFully(Compiled Code)
   at java.io.DataInputStream.readFully(Compiled Code)
   at rfbProto.readVersionMsg(Compiled Code)
 * at vncviewer.connectAndAuthenticate(Compiled Code)
   at vncviewer.run(Compiled Code)
   at java.lang.Thread.run(Compiled Code)
 java.net.SocketException: Socket closed

And the redirect log shows:

 [rid#5cc608/initial] (2) init rewrite engine with requested uri /vncserver
 [rid#5cc608/initial] (3) applying pattern '/vncserver' to uri '/vncserver'
 [rid#5cc608/initial] (2) rewrite /vncserver -> http://vncserver:5800
 [rid#5cc608/initial] (2) forcing proxy-throughput with http://vncserver:5800
 [rid#5cc608/initial] (1) go-ahead with proxy request
proxy:http://vncserver:5800 [OK]
 [rid#5cc608/initial] (2) init rewrite engine with requested uri
/vncviewer.jar
 [rid#5cc608/initial] (3) applying pattern '/vncserver' to uri
'/vncviewer.jar'
 [rid#5cc608/initial] (3) applying pattern '/vncviewer.jar' to uri
'/vncviewer.jar'
 [rid#5cc608/initial] (2) rewrite /vncviewer.jar ->
http://vncserver:5800/vncviewer.jar
 [rid#5cc608/initial] (2) forcing proxy-throughput with
http://vncserver:5800/vncviewer.jar
 [rid#5cc608/initial] (1) go-ahead with proxy request
proxy:http://vncserver:5800/vncviewer.jar [OK]

Notice the lack of any mention of vncviewer.class!  Something is happening
with the vncviewer.jar file and I have no clue what it could be.  Just to be
sure I stopped using the rewrite mod and went back to using ProxyPass and
ReverseProxyPass directives, and the errors are the same.  I switched to using
IE5.5sp2 and the same thing happens, except the error I get in the window is
java.io.EOFException.  I tried switching the /vncviewer.class redirect to
http://vncserver:5900/vncviewer.class without any results.

Does anybody know where I should go from here?  Is this a simple matter of
pointing the requests for the various .jar and .class files to the proper
place, or is something more serious happening?  When exactly does the shift
from port 5800 to 5900 happen?  That may be the key to getting this to work.

I appreciate any help anyone can offer.  Thanks a lot!

C-ya
Chris T
---------------------------------------------------------------------
To unsubscribe, mail majordomo "at" uk.research.att.com with the line:
'unsubscribe vnc-list' in the message BODY
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------