Help setting up cloudflared

I wanted to enable remote access to my HA instance and I thought Cloudflared might work for this.

As I use docker, I was thinking it would be easiest to just use it.

version: "3.8"
    container_name: homeassistant
      - /home/xxx/docker/homeassistant/homeassistant_config:/config
    restart: unless-stopped
      - TZ=Europe/Stockholm
    network_mode: host
      - 8123:8123

version: "3.8"
    image: cloudflare/cloudflared:latest
    container_name: cloudflared
    restart: unless-stopped
    command: tunnel run
      - TUNNEL_TOKEN=xxx

I modified my configuration.yaml to allow proxy calls:

# Allows proxy traffic from cloudflared
  use_x_forwarded_for: true

My cloudflared container successfully connect to clouflare and is shown up as healthy. However, when I access my domain,, cloud flare says host is having issues:

When I check logs on the cloudflare container, it says it cannot connect:

Anyone done the same? Any suggestions? :slight_smile:

I followed these videos:

Im guessing you are using cloudflare zero trust? if thats the case, you want to update under “Public Hostname Page - URL” with the same URL that you access HASS from within your network.

i.e.: if you use,
then change (from your picture) to

The way zero trust tunnel works is, it routes external traffic to your internal network in a secure way without having to open ports (extremely simplified explanation…there is a lot more to it… but basically thats it)

I was able to connect from the outside, let me know if this works for you.

also, if your website is for example:
and you want to connect to homeassistant using
you can add under subdomain “hass” and under domain → dropdown of your main site, which for this example is “”,
this allows you to have 1 domain for all your services…such as: for docker →, etc… and point each service to the same protocol (http or https) and their respective internal IP.

ITS IMPORTANT to note that if you access the service WITHIN your network with HTTPS…then use the same from the “Service / Type” dropdown… in example, I access docker through portainer as front end which uses port 9443 and its a secured port, so I would need to use HTTPS+IP:port

If you need help let me know.


Thank you! I actuallt got it working, turns out ai had added the wrong ip in the configuration.yaml file.

One strange thing however is that graphs don’t work when running via cloudflarded.