CloudFlare with 2 Home Assistants

Hello community
I have setup CloudFlare for 1 of 2 Home Assistants I have running on my home network (yes I know I can combine them over MQTT… I may chose to do that one day). I have setup a few other devices using subdomains using the HA CloudFlare integration w/o any issues (Web Server, Diskstation, etc). However, when I try to add my 2nd Home Assistant, I get [400: Bad Request].

Here is my HA CloudFlare config:

external_hostname: home.mydomain.com
additional_hosts:
  - hostname: barn.mydomain.com
    service: http://192.168.1.202:8123
  - hostname: ds.mydomain.com
    service: http://192.168.1.200:5000
  - hostname: www.mydomain.com
    service: http://192.168.1.200

I have added the following to both of my HA configuration.yaml files

http:
use_x_forwarded_for: true
trusted_proxies:
- 172.30.33.0/24

Should this be different on my 2nd Home Assistant (Barn)? I have no issues accessing the Barn HA using the IP address (192.168.1.202:8123)

Are you using this integration?

In general the configuration for main and secondary HA should not be different. Is your main HA through a proxy?

Actually I am using the “CloudFlared” add-on [https://github.com/brenner-tobias/addon-cloudflared/wiki]. I hadn’t realized there was an integration built in based on the setup guides I googled.

The 2 HAs are setup identically on my network. Prior to setup, they were reachable by:
192.168.1.201:8123 (Home)
192.168.1.202:8123 (Barn)

Did you check this troubleshooting for 400 errors

That looks like docker IP

Maybe there is another IP to add or did IP change

@tmjpugh - thanks for the reference. I have make sure everything ties out to the recommendations with no success.

Interesting new discovery. I have had issues with my CloudFlared add-on crashing every time I restart or stop the service. It seems it is 100% tied to my entry for the 2nd Home Assistant.

If I remove this section or change the IP address, not a problem and doesn’t crash, but as soon as I change it back to the HA-2 (Barn) IP address, I cannot make any changes to the add-on without it crashing my entire HA that the CloudFlared add-on is installed on.

I feel I am getting closer. I was curious and flipped my install so that the CloudFlared add-on runs on my Barn HA and then added a host reference to my “Home” HA. Now instead of the error:

[400: Bad Request]

I now get the following error with the Home Assistant background:

[Unable to fetch auth providers. https://home.mydomain.com/lovelace/default_view?auth_callback=1]

As I said above, I can add hosts for my diskstation and web server and it works with no issues, it is just my 2nd Home Assistant that doesn’t seem to work

Do you have auth_providers configured

Is it possible ip got banned?

I assume you are using a ZeroTrust tunnel?

@tmjpugh - I do not have auth_providers configured. I briefly just looked it up. I will give that a shot and see if it helps. Not sure about the IP being banned? I can get CloudFlared to work with each of my Home Assistants if it is installed on that machine. I just cannot access the other HA. If I install CloudFlared on HA-1, I can access it but not HA-2. If I install CloudFlared on HA-2, I can access it but not HA-1.

@LiQuid_cOOled - I am not using ZeroTrust. I’m out of my depth on this one, but I can do some research if you think this is a fix.

Are both your installs haos?

The addon presumes docker ip is always same but this will likely only be true for haos install or installs like vm that use haos. This is not true for other install methods

Sorry for the delay. Yes, both are HASOS installs on Raspberry Pi’s