Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Testing tinyproxy as both a forward and reverse proxy

License

Notifications You must be signed in to change notification settings

isabelcosta/testing-tiny-proxy

Repository files navigation

Testing TinyProxy

Description

This repo is used to test TinyProxy both as a proxy and a reverse proxy.

Repo Content

Configuration files:

  • default-configuration.conf - default configuration generated by tinyproxy
  • forwardproxy.conf - configuration file used at forward proxy
  • reverseproxy.conf - configuration file used at reverse proxy

Test

You may have to test this in root mode. My tests were made using virtual machines using Debian GNU/Linux 8.9 (jessie).

Architecture

architecture-image

The test consists of 4 virtual machines within the same network.

IPs

Client Proxy Reverse Proxy Server
10.0.2.33 10.0.2.35 10.0.2.36 10.0.2.34

Run

  • First make sure the the server is working and there is communication between the client and the server
curl http://10.0.2.34:80

Step by step example

  1. Run server Because in my example I run a simple apache server, I use the following command to start the web server:
/usr/local/apache2/bin/apachectl start
  1. Load tinyproxy configuration files at proxy and reverse proxy

To load the configuration you just have to run tinyproxy -c <configuration-file>. load-config.sh is a script to load the configuration file after stoping the proxy and before restarting the proxy.

2.1. Load Forward Proxy configuration

sh load-config.sh forwardproxy.conf

2.2. Load Reverse Proxy configuration

sh load-config.sh reverseproxy.conf
  1. Run client
  • Test a http request curl --proxy http://<proxy-ip>:<proxy-port> http://<reverse-proxy-ip>:<reverse-proxy-port>/path-to-server
curl -v --proxy http://10.0.2.35:8888 http://10.0.2.36:8888/test/

How to test the system

  • Check logging file
cat /var/log/tinyproxy/tinyproxy.log
  • When it works you may get an output similar to the following. Note that I'm using an Apache web server, which returns a simple HTML page ("It works!" HTML page).
debian@debian:~$ curl -v --proxy http://10.0.2.35:8888 http://10.0.2.36:8888/test/
* Hostname was NOT found in DNS cache
*   Trying 10.0.2.35...
* Connected to 10.0.2.35 (10.0.2.35) port 8888 (#0)
> GET http://10.0.2.36:8888/test/ HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 10.0.2.36:8888
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 OK
< Via: 1.0 tinyproxy2 (tinyproxy/1.8.3), 1.1 tinyproxy1 (tinyproxy/1.8.3)
< Date: Thu, 14 Dec 2017 16:43:26 GMT
< Last-Modified: Mon, 11 Jun 2007 18:53:14 GMT
< Content-Length: 45
< Set-Cookie: yummy_magical_cookie=/test/; path=/
< ETag: "2d-432a5e4a73a80"
< Accept-Ranges: bytes
< Content-Type: text/html
* Server Apache/2.4.29 (Unix) is not blacklisted
< Server: Apache/2.4.29 (Unix)
< 
<html><body><h1>It works!</h1></body></html>
* Connection #0 to host 10.0.2.35 left intact
  • If you want to use Wireshark to test this, you should see something like this:

wireshark-capture-image

Author

@isabelcosta did this!

About

Testing tinyproxy as both a forward and reverse proxy

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages