Python proxy server that handles HTTP/HTTPS requests
Install the sockets module if you don't have it:
$ pip install sockets
Or via requirements.txt
:
$ python3 -m venv /venv
$ source venv/bin/activate
$ pip install -r requirements.txt
Then simply run the server:
$ python3 proxy_server.py
Proxy server written in python, using the socket module, capable of handling HTTP and HTTPS.
- Creates a server socket at port 8080 by default that is ready to accept incoming connections from clients (ex. Mozilla)
- Receieves requests from the browser and determines whether connections are HTTP or HTTPS
HTTP
connections get immediately resolved,HTTPS
connections are persistent and stay open until closed
NOTE for HTTPS: This is not a 'Man in the middle' proxy that enables the user to see the tunneled HTTPS data, as the data sent between the browser and the remote webserver is encrypted, a man in the middle proxy would require the proxy server to have its own certificates that would decrypt the browser data, read it, and then encrypt them again and send to the remote web server. The browser and the remote web server would also need to trust the ProxyServer's certificates. This proxy only proxies the data, it does not read it. However, for HTTP connections, as they don't have encryption, the data passing through the proxy over a HTTP connection can be easily seen
- To configure the proxy with Mozilla check out this guide.
For other browsers please check out their documentation.
For more in depth details and the ideas behind it, check out the Jupyter Notebook file!
- Server started and is waiting for the browser to connect to it
- Connection is accepted - here, a request is made to Python docs, for example, and each further connection is handled