Skip to content

Configuration

Madhyamas is configurable through the web UI, CLI flags, and environment variables. This guide covers the most important settings and how to change them.

Config Dialog

Accessing Configuration

Via the Web UI

Click the Config button (sliders icon) in the top toolbar to open the configuration dialog. Here you can view and change settings without restarting.

Via the CLI

bash
# View current configuration
madhyamas config get

# Update a setting
madhyamas config update --intercept-https true

# View help for all options
madhyamas config update --help

Startup Options

These options are set when starting the proxy and can't be changed at runtime:

FlagEnvironment VariableDefaultDescription
--hostMADHYAMAS_HOST127.0.0.1Bind address. Use 0.0.0.0 for mobile/remote access
--proxy-portMADHYAMAS_PROXY_PORT8888Proxy server port
--api-portMADHYAMAS_API_PORT3001Web UI / API port
--public-ipMADHYAMAS_PUBLIC_IPauto-detectIP shown in UI for remote access
--verboseRUST_LOG=debugoffEnable verbose logging
--no-httpsoffDisable HTTPS interception
--max-requests10000Max requests kept in memory
--rate-limitoffEnable API rate limiting
--enable-socksMADHYAMAS_ENABLE_SOCKSfalseEnable the SOCKS5 listener (see SOCKS5 Proxy)
--socks-portMADHYAMAS_SOCKS_PORT1080SOCKS5 listener port
--allowed-ipMADHYAMAS_ALLOWED_IPS(all)IP/CIDR allowlist, repeatable (see Access Control)
--upstream-proxy-enabledMADHYAMAS_UPSTREAM_PROXY_ENABLEDfalseEnable upstream proxy chaining (see Upstream Proxy)
--upstream-proxyMADHYAMAS_UPSTREAM_PROXYUpstream proxy host:port
--upstream-protocolMADHYAMAS_UPSTREAM_PROTOCOLhttpUpstream protocol: http/https/socks5
--upstream-authMADHYAMAS_UPSTREAM_AUTHUpstream proxy auth as username:password
--upstream-no-proxyMADHYAMAS_UPSTREAM_NO_PROXYComma-separated bypass list

Runtime Configuration

These settings can be changed while the proxy is running:

HTTPS Interception

bash
madhyamas config update --intercept-https true   # Enable
madhyamas config update --intercept-https false   # Disable

When enabled, Madhyamas decrypts HTTPS traffic using its CA certificate. When disabled, HTTPS traffic passes through as an opaque tunnel.

Maximum Body Size

bash
madhyamas config update --max-body-size 52428800   # 50 MB

Controls the maximum response body size that Madhyamas will capture. Larger bodies are truncated. Increase this if you need to inspect large responses.

Maximum Requests in Memory

bash
madhyamas config update --max-requests 50000

Controls how many traffic entries are kept in memory. Older entries are automatically removed when the limit is reached. Lower this if memory usage is a concern.

Environment Variables

VariableDescriptionDefault
RUST_LOGLog level (trace, debug, info, warn, error)info
MADHYAMAS_HOSTBind host127.0.0.1
MADHYAMAS_API_PORTAPI/Web UI port3001
MADHYAMAS_PROXY_PORTProxy port8888
MADHYAMAS_PUBLIC_IPPublic IP for remote access displayauto-detect
MADHYAMAS_API_URLAPI URL for CLI/MCP modeshttp://127.0.0.1:3001
MADHYAMAS_WEB_DIROverride web asset directory (dev only)embedded

Data Directory

Madhyamas stores its data in ~/.madhyamas/:

~/.madhyamas/
├── certs/                  # TLS certificates
│   ├── madhyamas-ca.pem    # CA certificate (install in trust store)
│   └── madhyamas-ca-key.pem # CA private key
├── logs/                   # Application logs
└── traffic.db              # SQLite traffic database

Changing the Data Directory

You can override individual paths with CLI flags:

bash
madhyamas serve \
  --cert-path /custom/certs \
  --db-path /custom/traffic.db \
  --log-path /custom/logs

Capture Modes

Madhyamas has two capture modes, toggled via the Recording button in the top toolbar:

ModeBehavior
Recording (default)Captures all traffic to the database and displays it in the UI
PassthroughTraffic flows through the proxy but isn't recorded

Use Passthrough mode when you want the proxy running but don't need to capture traffic — for example, when you're only using mocks or rewrites without needing the traffic log.

Performance Tuning

High Traffic Volume

If you're capturing a lot of traffic:

bash
# Increase max requests
madhyamas config update --max-requests 50000

# Or reduce to save memory
madhyamas config update --max-requests 5000

Large Response Bodies

If responses are being truncated:

bash
# Increase max body size (default ~20 MB)
madhyamas config update --max-body-size 104857600   # 100 MB

Regular Cleanup

bash
# Clear all traffic
madhyamas traffic clear

# Delete old sessions
# Use the Sessions view in the web UI

Some features have their own dedicated configuration pages:

Released under the MIT OR Apache-2.0 License.