Skip to main content

HTTPS with Cloudflare Tunnel

Publish Hrida.ai on your own domain over HTTPS through Cloudflare, with no open ports and no certificates to manage.

Best for: production without open ports · Certificates: automatic, at Cloudflare's edge · Open ports: none

Cloudflare Tunnel (cloudflared) creates an outbound-only connection from your machine to Cloudflare's edge network. Traffic flows through Cloudflare's infrastructure with automatic TLS, DDoS protection, and access controls, all without exposing a single port on your server.

When to use Cloudflare Tunnel

This is the recommended approach when you want production-grade public access without managing TLS certificates or firewall rules. It works on any network, including behind NAT or restrictive firewalls.

Prerequisites​

RequirementDetails
Hrida.aiRunning locally on port 8080 (default)
Cloudflare accountFree at cloudflare.com
Domain on CloudflareYour domain's DNS must be managed by Cloudflare

Option a: Dashboard Setup (No CLI)​

  • Option A: Dashboard Setup: The simplest path. Everything configured through the Cloudflare dashboard.
  • Option B: CLI Setup: For automation, infrastructure-as-code, or headless servers.

The simplest path. Everything configured through the Cloudflare dashboard.

1. Create the tunnel​

  1. Go to Zero Trust → Networks → Connectors
  2. Click Create a tunnel → select Cloudflared
  3. Name it (e.g., hrida-ai)
  4. Follow the install instructions to run the connector on your machine

2. Add a public hostname​

In the tunnel config, add a Public Hostname:

FieldValue
Subdomainchat (or whatever you prefer)
DomainSelect your Cloudflare domain
Service typeHTTP
URLlocalhost:8080

Save. Cloudflare creates the DNS record automatically.

3. Access Hrida.ai​

Open https://chat.your-domain.com. HTTPS is handled entirely by Cloudflare.

Option B: CLI Setup​

For automation, infrastructure-as-code, or headless servers.

1. Install cloudflared​

bash
brew install cloudflared

2. Authenticate​

bash
cloudflared tunnel login

This opens a browser to authorize cloudflared with your Cloudflare account.

3. Create the tunnel​

bash
cloudflared tunnel create hrida-ai

Note the Tunnel ID in the output. You'll need it for the config.

4. Configure​

Create ~/.cloudflared/config.yml:

yaml
tunnel: YOUR_TUNNEL_ID
credentials-file: /home/YOUR_USER/.cloudflared/YOUR_TUNNEL_ID.json

ingress:
  - hostname: chat.your-domain.com
    service: http://localhost:8080
  - service: http_status:404

5. Create DNS record​

bash
cloudflared tunnel route dns hrida-ai chat.your-domain.com

6. Start the tunnel​

bash
cloudflared tunnel run hrida-ai

Open https://chat.your-domain.com.

Run as a System Service​

To keep the tunnel running after reboot:

bash
sudo cloudflared service install
sudo systemctl enable cloudflared
sudo systemctl start cloudflared

This uses the config at ~/.cloudflared/config.yml automatically.

Configure Hrida.ai​

Set HRIDAAI_URL so OAuth callbacks and internal links resolve correctly:

bash
docker run -d \
  -p 8080:8080 \
  -e HRIDAAI_URL=https://chat.your-domain.com \
  -v hrida-ai:/app/backend/data \
  --name hrida-ai \
  ghcr.io/hrida-ai/hrida-ai-studio:main

Docker Compose with cloudflared​

Run both Hrida.ai and the tunnel connector in a single stack:

yaml
services:
  hrida-ai:
    image: ghcr.io/hrida-ai/hrida-ai-studio:main
    container_name: hrida-ai
    volumes:
      - hrida-ai:/app/backend/data
    environment:
      - HRIDAAI_URL=https://chat.your-domain.com
    restart: unless-stopped

  cloudflared:
    image: cloudflare/cloudflared:latest
    container_name: cloudflared
    command: tunnel --no-autoupdate run --token YOUR_TUNNEL_TOKEN
    restart: unless-stopped

volumes:
  hrida-ai:

Get your tunnel token from the Cloudflare dashboard → Go to [Networking → Tunnels] → Select your tunnel → Select Add a replica → Copy the install command. The token starts with eyJ....

Tip

No ports needed on the hrida-ai service. cloudflared connects to it via Docker's internal network. To use this, change the service URL in your tunnel config to http://hrida-ai:8080.

Add Access Controls (Optional)​

Cloudflare Zero Trust lets you gate access behind authentication without touching Hrida.ai:

Users see a Cloudflare login page before reaching Hrida.ai.

Quick Reference​

WhatCommand / Value
Create tunnelcloudflared tunnel create hrida-ai
Start tunnelcloudflared tunnel run hrida-ai
Add DNScloudflared tunnel route dns hrida-ai chat.your-domain.com
Install as servicesudo cloudflared service install
Dashboarddash.cloudflare.com → Zero Trust → Networks → Connectors
Set CORS originCORS_ALLOW_ORIGIN=https://chat.your-domain.com
Hrida.ai is proprietary software of Zlabs Innovation. See the license for terms. © 2026 Zlabs Innovation.