Skip to content

Instantly share code, notes, and snippets.

@gordinmitya
Created September 10, 2025 05:56
Show Gist options
  • Select an option

  • Save gordinmitya/53023ee3eed6fa055f75b88c65cea349 to your computer and use it in GitHub Desktop.

Select an option

Save gordinmitya/53023ee3eed6fa055f75b88c65cea349 to your computer and use it in GitHub Desktop.
Public self-hosting with cloudflare tunnel

Public self-hosting with cloudflare tunnel. You better watch a video how to configure it in console but when you done just copy token .env TUNNEL_TOKEN="blahblah".

In cloudflare console you set public domain eg sample.gordinmitya.me and internal address - in our case you should use container name http://sample-service:80/

services:
cloudflared:
image: cloudflare/cloudflared:latest
restart: unless-stopped
command: tunnel --no-autoupdate run --token ${TUNNEL_TOKEN}
environment:
- TUNNEL_TOKEN=${TUNNEL_TOKEN}
networks:
- tunnel-proxy
# everything is http here
# tls will be added later by cloudflare server
caddy:
image: caddy:2
container_name: sample-service
networks:
- tunnel-proxy-local
# no need to expose ports - everything is inside docker network
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment