How taksan/proxy-glass works
1. What the system is
ProxyGlass is a local HTTP interception tool with two user-facing surfaces: a transparent proxy that sits between a client and a target server, and a web console that visualizes captured traffic in real time.
2. Core runtime topology
The app is split into three active roles:
- Proxy listener on --source-port
- Target forwarder on --target-port
- Web UI/API server on --web-port
These all run on the same host, usually 127.0.0.1, with --host controlling bind interface.
3. Capture and forwarding path
The main request flow is: client → proxy listener → target server → proxy listener → client.
While forwarding, the proxy records request metadata, bodies, response metadata, timing, and status into shared application state.
4. Shared state / log storage
proxyglass/logstore.py is the central state container. It holds the ordered collection of captured entries and is the main boundary between the network-capture side and the UI side. The tests suggest it also supports clearing and persistence-related behavior.
5. Data model boundary
proxyglass/models.py defines the structured representation of captured traffic. This is where request/response entry shape, timestamps, durations, and body encoding decisions are likely normalized before being stored or serialized.
6. Real-time update channel
proxyglass/websocket_manager.py is the notification layer between the proxy/log store and browsers. When a request is created, updated with a response, or the log is cleared, the manager pushes events to connected WebSocket clients so the UI updates live without polling.
7. Web application layer
proxyglass/web_app.py serves the operator-facing interface and JSON endpoints. The documented API is:
- GET /api/entries
- GET /api/entries/{id}
- POST /api/clear
- WS /ws
This is the automation and dashboard boundary for external consumers.
8. HTML presentation layer
proxyglass/templates/index.html and proxyglass/templates/detail.html are the server-rendered UI surfaces. The browser experience is enhanced with client-side behavior for:
- split-pane request/detail browsing
- keyboard navigation
- WebSocket reconnection
- JSON pretty-printing / highlighting
- SSE rendering as structured tables
- resizable panes
9. Content-aware rendering
The UI treats some payloads specially:
- application/json bodies can be pretty-printed and syntax highlighted
- text/event-stream bodies are rendered as nested event rows
- JSON inside SSE data fields gets its own formatting toggle
This is presentation logic on top of stored raw traffic, not a change to capture semantics.
10. Startup and CLI orchestration
proxyglass/cli.py is the installed command entry point, while proxyglass/run.py is a legacy module entry path. These modules parse ports/host/version flags and wire together the proxy server, web server, and shared store.
11. Observability and operator workflow
The operator sends traffic to the proxy port, watches live updates in the web UI, drills into a selected entry for headers/body details, and can clear all logs from the interface or API. The live status indicator and auto-reconnect behavior are part of that operational loop.
12. Test-driven architecture clues
The test suite is broad and maps cleanly to the subsystems:
- test_models.py, test_logstore.py for core state
- test_proxy_app.py, test_streaming_integration.py, test_e2e.py for forwarding and capture
- test_web_app.py, test_websocket.py for UI/API/event delivery
- test_json_prettify.py, test_sse_and_json_highlighting.py, test_keyboard_navigation.py, test_split_interface.py for browser behavior
That suggests a clean separation between capture, storage, realtime broadcast, and presentation.
Main entry points: web_app.py Web app · tests Tests · proxy_app.py Proxy app · index.html Dashboard
Components 16
Runtime
Command-line startup and the active proxy/web processes
Core capture
Traffic capture, storage, and data model boundaries
- Proxy app · Transparent proxy listener and forwarding pipeline between client and target server
proxyglass/proxy_app.py - Log store · Ordered capture store and boundary between network interception and UI access
proxyglass/logstore.py - Models · Structured request and response entry model with timing and body normalization
proxyglass/models.py
Web surface
HTTP API, websocket updates, and rendered browser UI
- WebSocket mgr · Pushes create update and clear events from capture state to connected browsers
proxyglass/websocket_manager.py - Web app · Operator-facing HTTP API and websocket endpoint for browsing and clearing captures
proxyglass/web_app.py - Dashboard · Main split-pane traffic browser and live status interface
proxyglass/templates/index.html - Detail view · Selected-entry page for headers bodies and deep inspection
proxyglass/templates/detail.html - Entries API · Lists captured entries and fetches individual entry details
proxyglass/web_app.py - Clear API · Clears captured logs from the shared store
proxyglass/web_app.py - Live WS · WebSocket channel for real-time UI updates
proxyglass/web_app.py - Browser UI · Client-side behavior for navigation reconnection resizing and formatting
proxyglass/templates/index.html - JSON render · Pretty printing and highlighting for JSON bodies and nested JSON payloads
proxyglass/templates/index.html - SSE render · Structured rendering for text event stream bodies and data fields
proxyglass/templates/index.html
Other components
- Tests · Architecture-level coverage for models storage proxy flow web UI websocket and persistence
tests
Connections 27
- CLI → Proxy app: starts · Creates and configures the proxy listener
- CLI → Web app: starts · Creates and configures the web server
- CLI → Log store: shares · Provides shared capture state to both runtimes
- Run path → CLI: delegates · Legacy entry path forwards into the main CLI startup
- Proxy app → Models: normalizes · Builds structured traffic entries from live request and response data
- Proxy app → Log store: stores · Writes captured entries and updates into shared state
- Proxy app → WebSocket mgr: publishes · Notifies live clients when entries are created or updated
- Log store → Models: contains · Holds ordered captured entries using the shared entry schema
- Web app → Entries API: exposes · Serves entry listing and detail retrieval endpoints
- Web app → Clear API: exposes · Serves the log clearing endpoint
- Web app → Live WS: exposes · Serves the browser websocket endpoint
- Web app → Dashboard: renders · Serves the main dashboard page
- Web app → Detail view: renders · Serves the entry detail page
- WebSocket mgr → Live WS: feeds · Delivers live events to connected browser clients
- Dashboard → Browser UI: contains · Hosts the client-side behavior for live browsing
- Dashboard → JSON render: formats · Pretty prints and highlights JSON payloads
- Dashboard → SSE render: formats · Renders event-stream payloads as structured rows
- Browser UI → Entries API: reads · Loads the capture list and entry details
- Browser UI → Live WS: subscribes · Receives live updates and reconnects on disconnect
- Browser UI → Clear API: clears · Triggers log clearing from the UI
- Detail view → JSON render: uses · Applies content-aware formatting for bodies and payloads
- Detail view → SSE render: uses · Applies event-stream specific rendering
- Tests → Models: verifies · Covers entry schema and normalization behavior
- Tests → Log store: verifies · Covers storage clearing ordering and persistence behavior
- Tests → Proxy app: verifies · Covers forwarding capture and streaming integration
- Tests → Web app: verifies · Covers HTTP API and dashboard behavior
- Tests → WebSocket mgr: verifies · Covers websocket event delivery