diff --git a/README.md b/README.md new file mode 100644 index 0000000..74359a3 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# ComfyUI HTTPS Bridge + +A ComfyUI custom node that automatically starts a local HTTPS proxy server, enabling web applications deployed on public HTTPS pages to securely connect to your local ComfyUI instance. + +## The Problem + +Modern browsers block connections from HTTPS pages to HTTP endpoints (mixed content policy). This means if you use a ComfyUI web UI hosted on `https://yourapp.com`, it cannot directly connect to your local `ws://localhost:8188`. + +## The Solution + +This node starts a local HTTPS proxy on port 9999 that sits between the browser and ComfyUI: + +``` +Browser (HTTPS page) + ↓ wss://localhost:9999 (trusted self-signed cert) +ComfyUI HTTPS Bridge ← this node + ↓ ws://localhost:8188 (local, no restrictions) +ComfyUI +``` + +## Features + +- **Zero configuration** — starts automatically when ComfyUI loads +- **No external tools required** — generates self-signed certificates using Python's `cryptography` library +- **Auto-detects ComfyUI address** — reads `--listen` and `--port` startup arguments automatically +- **Smart IP detection** — when ComfyUI uses `--listen 0.0.0.0`, resolves to the actual local network IP +- **Full proxy support** — handles HTTP requests, WebSocket connections, and image streaming + +## Installation + +### Via ComfyUI Manager +Search for `ComfyUI-HTTPS-Bridge` and install. + +### Manual +```bash +cd ComfyUI/custom_nodes +git clone https://github.com/caissonfiv/comfyui-https-bridge.git +``` + +Then install dependencies: +```bash +pip install -r custom_nodes/comfyui-https-bridge/requirements.txt +``` + +Restart ComfyUI. The bridge starts automatically in the background. + +## First-Time Browser Setup (Once Only) + +Because the certificate is self-signed, your browser needs a one-time authorization: + +1. Open **https://localhost:9999** in your browser +2. Click **Advanced** → **Proceed to localhost** +3. You'll see a blank page — that means it's working + +After this, the browser remembers the exception permanently. + +## Usage + +In your ComfyUI web app's connection settings, enter: +``` +https://localhost:9999 +``` + +You should see "ComfyUI Connected" in the app. + +## Configuration + +All settings are optional via environment variables: + +| Variable | Default | Description | +|----------|---------|-------------| +| `COMFY_BRIDGE_PORT` | `9999` | HTTPS bridge port | +| `COMFY_HOST` | auto-detected | Override ComfyUI host | +| `COMFY_PORT` | auto-detected | Override ComfyUI port | + +**Address detection priority:** +1. Environment variables `COMFY_HOST` / `COMFY_PORT` (highest) +2. ComfyUI startup args `--listen` / `--port` (auto-read) +3. Default `127.0.0.1:8188` + +**Example — custom port:** +```bash +COMFY_BRIDGE_PORT=9998 python main.py +``` + +**Example — remote ComfyUI:** +```bash +COMFY_HOST=192.168.1.50 COMFY_PORT=8188 python main.py +``` + +## Requirements + +- Python 3.8+ +- `cryptography` — for self-signed certificate generation +- `aiohttp` — for the HTTPS proxy server (already included in ComfyUI) + +## License + +MIT