# jianda-proxy HTTP proxy for Gitea LFS -- rewrites Host header to bypass ICP domain blocking. **Repository:** `ssh://git@git.zz.com:2222/Developer/jianda-proxy.git` ## 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 ```bash uv tool install git+ssh://git@git.zz.com:2222/Developer/jianda-proxy.git ``` ## CLI Commands ### Start the proxy ```bash # 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 ```bash jianda-proxy stop ``` ### Check status ```bash jianda-proxy status ``` ### Manage configuration ```bash # 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 1. Install and start the proxy: ```bash jianda-proxy start ``` 2. Configure Git to route LFS requests through the proxy (one-time setup): ```bash git config --global http.http://git.zz.com:3000/.proxy http://127.0.0.1:13000 ``` 3. Clone as usual: ```bash git clone ssh://git@git.zz.com:2222/Developer/jianda-proxy.git ``` LFS downloads will be routed through the proxy transparently. ## Running without installation ```bash # 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.