A Python-based caching proxy server that forwards HTTP requests between clients and target servers. Includes features like caching, request logging, blacklist/whitelist filtering, and concurrent connections. And a web-based admin interface.
This project implements a caching proxy server in Python. The proxy server forwards requests from clients to target servers, relays back responses, and enhances performance through caching. It also provides features such as logging, request filtering (blacklist/whitelist), and concurrent client handling.
- Accepts client requests and forwards them to target servers.
- Relays responses back to clients.
- Supports HTTP (and optionally HTTPS).
- Manages connections using raw sockets.
- Listens for client requests on a configurable port.
- Establishes connections with target servers for data transfer.
- Extracts host, port, HTTP method, and URL.
- Modifies headers (e.g.,
Host) as required.
- Handles multiple clients concurrently via multithreading.
Logs details such as:
- Client IP/port
- Target server address/port
- HTTP method and URL
- Request/response timestamps
- Error messages
- Stores responses for repeated requests.
- Supports cache invalidation based on headers (
Cache-Control,Expires) or custom timeout.
- Restricts access to specific domains/IPs.
- Custom response for blocked requests.
- Supports tunneling HTTPS securely (without decryption).
- Optional SSL/TLS decryption (MITM) using self-signed certificates. (For educational/debugging purposes only!)
Web-based interface to:
- View/manage logs
- Inspect cache entries
- Configure blacklist/whitelist
- Display proxy usage statistics
- Python 3.8+
- Standard libraries:
socket,threading,logging,datetime - SQLite3
- (Optional)
sslfor HTTPS MITM - (Optional)
Streamlit+pandafor the admin interface
proxy-server/
- │── proxy.py # Main proxy server implementation
- │── cache/ # Cache storage (if file-based caching used)
- │── logs/ # Log files
- │── config.json # Configuration file (blacklist/whitelist, cache settings, etc.)
- │── README.md # Project documentation
- Scale up and use SQL DB
- Make the logging cleaner
- Work on Interface.py to make it more pro
- Additional bonus features include HTTPS support, SSL/TLS decryption (MITM), and a web-based admin interface for managing the proxy.
git clone https://github.com/your-username/proxy-server.git
cd proxy-server