The University firewall does not allow direct access to the Informatics Teaching Network Apache Tomcat server (tomcat.tn.informatics.scitech.susx.ac.uk) from off-campus. Although, students using this server for their coursework or project work will be able to access (SSH) Teaching Network UNIX server (unix.tn.informatics.scitech.susx.ac.uk) from anywhere in the world and compile servlets, write JSP, etc., there is no straightforward way of testing the output of these from off-campus connections. Tunnelling through a SSH connection is the obvious solution but there is another subtle configuration issue to take care of so that the correct host on the Tomcat server receives the requests tunnelled through SSH.
Choose a free port on your client machine. Usually a high number port (> 10000 and < 65536) will do. We will use 16080 in this example. Use a SSH client to forward this local port to port 8080 of tomcat.tn.informatics.scitech.susx.ac.uk over a SSH connection to unix.tn.informatics.scitech.susx.ac.uk.
On UNIX/MacOS/Linux, you can do this from the command line as follows:
ssh -L 16080:tomcat.tn.informatics.scitech.susx.ac.uk:8080 {username}@unix.tn.informatics.scitech.susx.ac.uk
where {username} should be replaced by your Informatics username.
On Windows, you can do this using a third-party SSH client. We will use PuTTY in this example. You can download PuTTY from here. Downloading just the latest binary of putty.exe will do. You do not need to install anything. Once downloaded, run putty.exe.
Once PuTTY starts, type unix.tn.informatics.scitech.susx.ac.uk in the Host Name text entry field. Choose SSH in the Protocol radio button. Using the left-hand navigation tree, select Connection > SSH > Tunnels item. Type 16080 in the Source port text entry field and type tomcat.tn.informatics.scitech.susx.ac.uk:8080 in the Destination entry field. Click on the Add button. You will now see this forwarding entry in the list of Forwarded ports. Go back to the Session item in the left-hand navigation tree. Type unix-tn in the Saved Sessions text entry field and click on the Save button. You will now see the unix-tn entry in the list of Saved Sessions. Double-click on this entry to connect. If this is the first time, it will warn you about the identity of the UNIX server. Accept it by clicking Yes on the warning message. Login to the UNIX server with your Informatics username and password.
That's it. Port forwarding is done. Now, localhost:16080 is forwarded to tomcat.tn.informatics.scitech.susx.ac.uk:8080. However, if you invoke any resource from http://localhost:16080/{username}/{servlet-uri-pattern}, it will not respond as you would expect. (Obviously, {username} is to be replaced by your username and {servlet-uri-pattern} with the URL of the servlet that you want to call. This is because the call to localhost will trigger a wrong Tomcat host configuration on the Tomcat server. The server needs to think that the call is for the host configuration identified by tomcat.tn.informatics.scitech.susx.ac.uk. This can be changed locally on your machine.
On UNIX/MacOS/Linux, you can do this by editing the /etc/hosts file. On Windows, you need to edit the C:\Windows\system32\drivers\etc\hosts file. Add the line:
127.0.0.1 tomcat.tn.informatics.scitech.susx.ac.uk
to the end of the file and save it. Do not remove or edit any existing entry.
That's it. Now, point your browser to http://tomcat.tn.informatics.scitech.susx.ac.uk:16080/{username}/SessionServlet and you should be able to see what you see at http://tomcat.tn.informatics.scitech.susx.ac.uk:8080/{username}/SessionServlet from the teaching labs. (Of course, change {username} to your username!) You can try accessing SessionServlet from my directory as a starter to check if this works -- http://tomcat.tn.informatics.scitech.susx.ac.uk:16080/ab25/SessionServlet.
If it doesn't work then do contact Ian (i.mackie [at] sussex [dot] ac [dot] uk) or myself (a.basu [at] sussex [dot] ac [dot] uk) but if it does then enjoy working from home!!