HTTP Proxy Server
π Overview
HTTP Proxy Server is an advanced solution to manage, audit, and control HTTP/HTTPS traffic, ideal for companies and developers. You can run it as a Windows service or as a Python script.
Main features:
- π Persistent and isolated sessions for each client
- β‘ Full RESTful API: login, proxy, session management, headers and cookies
- π οΈ Flexible configuration via
.envfile or environment variables - π Detailed activity logs
- π§© Interactive documentation (Swagger UI)
π How to run the server?
π₯οΈ As an executable (Windows)
- Place
HttpProxyServer.exein the desired folder and run:The process runs in the background, with no visible console.HttpProxyServer.exe
π As a Python script (development)
- Clone the repository and enter the folder:
git clone <repo_url> cd http-proxy-server
- Create a virtual environment and install dependencies:
python -m venv venv venv\Scripts\activate pip install -r requirements.txt
- Run the server:
python main.py
βοΈ Configuration
Configuration is flexible and follows this priority:
.envfile (in the same folder as the executable/script)- Environment variables
- Default values
Example .env:
SERVER_HOST=0.0.0.0
SERVER_PORT=8000
LOG_LEVEL=info
ACCESS_LOG=false
RELOAD=false
WORKERS=1
SESSION_TIMEOUT=600
CLEANUP_INTERVAL=300Equivalent environment variables:
set SERVER_HOST=0.0.0.0
set SERVER_PORT=9000
set LOG_LEVEL=debug
set SESSION_TIMEOUT=1200
set CLEANUP_INTERVAL=600
set ACCESS_LOG=trueπ Main endpoints and use cases
Note: After creating a session, you must send the
X-Session-IDheader in all requests.
Health Check
GET /health-check β Checks server and connectivity status.
Create session
POST /subscribe β Creates a unique session for the client.
Response:
{
"status": "OK",
"session": { "session_id": "..." }
}Delete session
POST /unsubscribe β Deletes the session and clears cookies/headers.
Set custom headers
POST /set-headers β Defines HTTP headers for the session.
{
"Authorization": "Bearer token123",
"X-Custom-Header": "CustomValue"
}Get current headers
POST /get-headers β Returns the configured headers.
Get current cookies
POST /get-cookies β Returns the session's active cookies.
Full session info
POST /get-session-info
HTTP/HTTPS proxy requests
POST /forward β Forwards any HTTP/HTTPS request using the active session.
{
"url": "https://api.company.com/data",
"method": "GET",
"headers": { "Accept": "application/json", "X-Session-ID": "abc123" }
}File download
POST /dowwnload β Downloads binary files while maintaining session and authentication.
{
"url": "https://files.company.com/download/file.zip",
"method": "GET"
}π Logs
- All events are logged in
HttpProxyServer.log. - Levels: debug, info, warning, error.
- Example:
2026-01-15 20:49:00,123 [INFO] __main__ - Application initialized successfully 2026-01-15 20:49:01,456 [INFO] __main__ - Starting service health check
π How to stop the server?
- Task Manager:
Ctrl+Shift+Escβ findHttpProxyServer.exeβ end process - Command line:
taskkill /f /im HttpProxyServer.exe - PowerShell:
Get-Process -Name "HttpProxyServer" | Stop-Process -Force
π Typical workflow example
- Create session:
POST /subscribe - Login to external system using
/forward:curl -X POST "http://localhost:8000/forward" \ -H "Content-Type: application/json" \ -d '{ "url": "https://system.company.com/login", "method": "POST", "data": { "username": "my_user", "password": "my_password" }, "headers": { "Content-Type": "application/x-www-form-urlencoded" } }'
- Make authenticated requests:
POST /forward - Download files:
POST /dowwnload - Set custom headers:
POST /set-headers - Logout:
POST /unsubscribe
π οΈ Troubleshooting
- Port in use: Change the port in
.envor stop the existing process. - Permissions: Run as administrator or use ports >1024.
- No internet: Check network, corporate proxy, or firewall.
π Security
- HTTPS support, robust validation, audit logging, security headers, configurable timeouts, and more.
π Interactive documentation
Developer: Raul Mauricio UΓ±ate Castro
Version: 3.0.0
Date: January 20, 2026