Skip to content

codingworkflow/reverse-proxy-webui

Repository files navigation

HTTP Proxy Logger with UI

Simple HTTP proxy logger that captures and logs HTTP requests and responses. It includes a web UI for viewing and managing the logs. Filter error codes and path. Based on mitm.

alt text

Features

  • Proxies HTTP requests and logs them to files
  • Web UI for viewing request/response details
  • Ability to clear logs with a single button
  • Auto-refresh to show new requests
  • Color-coded method types and error statuses

Configuration

Configuration is managed through config.yaml:

# Proxy Configuration
server:
  listen_port: 8083   # Port that the proxy server listens on
  forward_port: 8081  # Port to forward requests to
  host: localhost     # Host for both listening and forwarding

ui:
  enabled: true       # Whether to enable the UI
  port: 8080          # Port for the UI web server

logging:
  log_dir: request_log  # Directory to store logs

Usage

  1. Install dependencies:

    make install
    
  2. Run the proxy:

    make start
    
  3. Access the UI in your browser:

    http://localhost:8080
    
  4. Configure your client to use the proxy (e.g., http://localhost:8083)

Note: The main.py proxy buffers full responses and is best for standard HTTP. SSE streams are long-lived and should be inspected with mitmproxy using the addon below.

Custom Configuration

You can specify a custom configuration file using the PROXY_CONFIG environment variable:

PROXY_CONFIG=/path/to/custom-config.yaml python main.py

SSE debugging with mitmproxy (recommended)

This repo includes a mitmproxy addon that logs SSE frames and JSON-RPC POST bodies. It is more reliable than the buffering proxy when debugging MCP SSE transports.

  1. Install mitmproxy:

    uv pip install -r requirements.txt
    
  2. Start mitmproxy with the addon:

    MCP_SSE_LOG_DIR=./sse_logs \
    mitmdump -p 8085 -s addons/mcp_sse_logger.py --set stream_large_bodies=0
    

    Or via Make (override vars as needed):

    MCP_SSE_LOG_DIR=./sse_logs \
    make mitm-sse
    
  3. Route your client through the proxy:

    HTTP_PROXY=http://127.0.0.1:8085 \
    HTTPS_PROXY=http://127.0.0.1:8085 \
    NO_PROXY= \
    mcp-cli --url http://127.0.0.1:8080/sse --transport sse list
    

If your client ignores proxy settings for localhost (Go clients do this by default), run mitmproxy in reverse mode and point the client directly at the mitm port:

MCP_SSE_LOG_DIR=./sse_logs \
mitmdump -p 8085 -s addons/mcp_sse_logger.py --set stream_large_bodies=0 \
  --mode reverse:http://127.0.0.1:8080

# Or via Make:
MCP_SSE_LOG_DIR=./sse_logs \
make mitm-sse MITM_MODE=--mode\ reverse:http://127.0.0.1:8080

mcp-cli --url http://127.0.0.1:8085/sse --transport sse list

Log output:

  • sse_logs/sse_*.log captures the SSE stream (event: / data: lines).
  • sse_logs/sse_posts.log captures client->server JSON-RPC POST bodies.

Notes:

  • For HTTPS targets, install the mitmproxy CA cert or use --ssl-insecure as needed.
  • NO_PROXY often includes 127.0.0.1 by default; clear it to ensure proxying.

UI Features

  • View a list of all captured requests
  • Click on a request to see detailed information
  • View request/response headers and bodies
  • Clean all logs with a single button
  • Auto-refresh to show new requests as they come in

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published