Testing your proxy

In your class environment, you may or may not have access to the Internet. If you don't, that's no problem. If you do, that's an added bonus. I'm going to assume you do not have access to the Internet. You can simulate an Internet connection using your web or ftp servers, but since you probably don't know how to set these up yet, let's leave that till we've finished this course. Your final lab will require that you configure all these services from scratch on a clean Linux install.

In order to test your proxy, you may choose any web browser. I will cover two here. The first is lynx.

Lynx is a text-based web browser that is fast and light. It is very useful for ignoring those slow-to-download images and the pesky banner ads that make the World Wide Web so slow.

Wait! In order to get lynx to use the proxy, you will need to set at least one environmental variable: http_proxy

export http_proxy="http://calamari.jungle.org.za:8080"
            
[Note] Note

"http://calamari.jungle.org.za:8080" should be replaced with the domain name or IP address of your machine on which you configured Squid. e.g.. export http_proxy="http://192.168.0.1:8080"

Now, start lynx with:

lynx www.windowsintoafrica.com
            

Of course, we don't have Internet access, so the www.windowsintoafrica.com will time out, but we can still consult the squid log files to determine whether the client (lynx) used the proxy or not.

Perform a tail on the access.log file (usually in /var/log/squid - if yours is not there, then look in the squid.conf file for the cache_access_log directive).

tail -20 /var/log/squid/access.log
            

You should see something similar to:

59437.023  39923 192.168.1.24 TCP_MISS/504 1139 
GET http://www.windowsintoafrica.com/favicon.ico - NONE/- -
            

Here the TCP_MISS means that the proxy was missing this file, and therefore would need to contact the site and retrieve it on your (actually lynx's) behalf.

Lynx error message

Of course, the proxy cannot do that so lynx will return an error such as:


ERROR: The requested URL could not be retrieved
                                                                                                                     
                        ERROR

The requested URL could not be retrieved
     ____________________________________________________

   While trying to retrieve the \
                    URL: http://www.windowsintoafrica.com/
                                                                      
   The following error was encountered:                               
     * Connection Failed               
                         
   The system returned:  
    (110) Connection timed out
                              
   The remote host or network may be down. \
                    Please try the request again.

   Your cache administrator is hamish@QEDux.co.za.
     ____________________________________________________

   Generated Fri, 20 Feb 2004 08:11:35 GMT \
                    by calamari.jungle.org.za 
   (Squid/2.4.STABLE6)
End of error message.
                

If you were using a GUI web browser (say Mozilla or similar), you could configure the browser to use the proxy by following the settings:

Tools -> Options -> General -> Connection Settings
-> Manual Proxy Configuration -> HTTP Proxy
                

And enter your proxy (using the DNS name or the IP address) as well as the port on which your proxy is listening.

Now, try to go the same site: www.windowsintoafrica.com, and you should get a similar response to that returned by Lynx.

Whether you have Internet access or not, you should see an entry appear in your access file indicating that your http request was redirected to the proxy.