Skip to content

Https for full config #277

Closed
Closed

Description

@miladmeidanshahi

Hi tnanks for the project,
Please add doc for full config node HTTPS with domain on VPS it's helpful.

Activity

  1. therealaleph commented on Apr 26, 2026

    @therealaleph
    Owner

    Hi @miladmeidanshahi — fair documentation request. Let me sketch the setup here; I'll write a proper docs/full-mode-https.md for v1.7.x.

    Why HTTPS for tunnel-node matters:

    By default, the Docker image (ghcr.io/therealaleph/mhrv-tunnel-node:latest) listens on plain HTTP. Apps Script's UrlFetchApp.fetch() rejects self-signed certs and won't talk to a plain-HTTP backend if the destination URL is HTTPS — the request just times out.

    Setup with Caddy (easiest, automatic Let's Encrypt):

    On your VPS (with a domain pointing at it):

    # 1. tunnel-node container, listening on internal port 8080
    docker run -d --name mhrv-tunnel \
      --restart unless-stopped \
      -p 127.0.0.1:8080:8080 \
      -e MHRV_AUTH_KEY="$(openssl rand -hex 16)" \
      ghcr.io/therealaleph/mhrv-tunnel-node:latest
    
    # Save that auth key — you'll need it on every mhrv-rs client.
    
    # 2. Caddy in front for TLS termination
    docker run -d --name caddy \
      --restart unless-stopped \
      -p 80:80 -p 443:443 \
      -v $PWD/Caddyfile:/etc/caddy/Caddyfile \
      -v caddy_data:/data \
      --network host \
      caddy:latest

    Caddyfile (replace tunnel.your-domain.com with your actual subdomain):

    tunnel.your-domain.com {
        reverse_proxy 127.0.0.1:8080
        
        # Tighten timeouts for long-poll UX. Default 60s would close
        # the long-poll session before tunnel-node naturally returns.
        reverse_proxy 127.0.0.1:8080 {
            transport http {
                read_timeout 6m
                write_timeout 6m
            }
        }
    }
    

    Caddy auto-fetches a Let's Encrypt cert for tunnel.your-domain.com on first run. Verify:

    curl -I https://tunnel.your-domain.com/
    # Should return 405 (Method Not Allowed — tunnel-node only accepts POST)

    In CodeFull.gs (Apps Script):

    const TUNNEL_NODE_URL = "https://tunnel.your-domain.com";
    const AUTH_KEY = "<the-hex-key-from-step-1>";

    Save → Deploy → New deployment → Web app.

    In mhrv-rs config.json:

    {
      "mode": "full",
      "tunnel_node_url": "https://tunnel.your-domain.com",
      "auth_key": "<the-hex-key>",
      "deployment_ids": ["AKfycb..."]
    }

    Alternative: nginx with certbot. If you prefer nginx, the shape is the same — listen on 443 with a Let's Encrypt cert, proxy_pass to http://127.0.0.1:8080. Caddy is just less config.

    Domain-less alternative: if you don't have a domain, you can use a free DDNS service (DuckDNS, FreeDNS) and point <something>.duckdns.org at your VPS IP. Caddy handles those the same way.

    Filing as tracking for docs/full-mode-https.md in v1.7.x. Once the doc lands I'll update this comment.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  2. miladmeidanshahi commented on Apr 26, 2026

    @miladmeidanshahi
    Author

    is it deployed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions