Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
jianda-proxy
HTTP proxy for Gitea LFS -- rewrites Host header to bypass ICP domain blocking.
Background
Internal Gitea is exposed via a reverse tunnel on a Tencent Cloud server. The client resolves the domain via hosts file to the cloud IP. SSH clone works fine, but LFS file downloads go over HTTP. Tencent Cloud detects the unregistered domain from the Host header and blocks the request with a 302 redirect.
This proxy rewrites the Host header on all requests to the upstream IP address, bypassing the ICP block.
Installation
# Install as a global CLI tool (recommended)
uv tool install .
# Or with pip
pip install .
CLI Commands
Start the proxy
# Start as a background daemon (default)
jianda-proxy start
# Run in the foreground (useful for debugging)
jianda-proxy start --foreground
# Override the listen port
jianda-proxy start --port 8080
Stop the proxy
jianda-proxy stop
Check status
jianda-proxy status
Manage configuration
# View all config values
jianda-proxy config list
# Get a specific value
jianda-proxy config get upstream_host
# Set a value
jianda-proxy config set listen_port 8080
# Show config file path
jianda-proxy config path
Configuration
Default values (written to config file on first run):
| Key | Default | Description |
|---|---|---|
| remote_domain | git.zz.com | Domain to intercept |
| upstream_host | 62.234.191.215 | Upstream server IP |
| upstream_port | 3000 | Upstream server port |
| listen_host | 127.0.0.1 | Proxy listen address |
| listen_port | 13000 | Proxy listen port |
Config file location: ~/.config/jianda-proxy/config.ini (or %APPDATA%\jianda-proxy\config.ini on Windows).
Example Workflow
- Install and start the proxy:
jianda-proxy start
- Configure Git to route LFS requests through the proxy (one-time setup):
git config --global http.http://git.zz.com:3000/.proxy http://127.0.0.1:13000
- Clone as usual:
git clone ssh://git@git.zz.com:2222/your-repo.git
LFS downloads will be routed through the proxy transparently.
Running without installation
# Via uv
uv run python -m jianda_proxy start --foreground
# Via python directly
python -m jianda_proxy start --foreground
Root Cause Fix
Setting ROOT_URL in Gitea's app.ini to the IP address (e.g. http://62.234.191.215:3000) eliminates the need for this proxy entirely.