Reverse Proxy help /w homeassistant

1. Output of caddy version:

v2.5.1 h1:bAWwslD1jNeCzDa+jDCNwb8M3UJ2tPa8UZFFzPVmGKs=

2. How I run Caddy:

docker:


 caddy:
     container_name: caddy
     env_file:
       - ./envs/common.env
       - ./envs/caddy.env
     image: ghcr.io/dulanic/caddy:stable
     ports:
       - '80:80'
       - '443:443'
     restart: unless-stopped
     volumes:
       - ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
       - ./caddy/subsites:/etc/caddy/subsites:ro
       - ./caddy/mime.types:/etc/mime.types:ro
       - ./caddy/data:/data
       - ./caddy/config:/config
       - ./caddy/img:/www/img:ro
       - ./caddy/vid:/www/vid:ro
       - ./caddy/css:/www/css:ro
       - ./caddy/icons:/www/icons:ro
       - ./caddy/files:/www/files:ro
       - ./caddy/websites:/www/websites:ro
       - /home/dulanic/docker/nextcloud:/var/www/html
       - ./recipes/media:/media
       - /mnt/btrfs/youtube:/www/ytdl:ro

a. System environment:

Ubuntu 20.04
Docker version 20.10.17, build 100c701

b. Command:

N/A - It's a docker container

c. Service/unit/compose file:

d. My complete Caddy config:

###################
# Global Settings #
###################
{
	default_sni dulanic.com
	order replace after encode
}

############
# Snippets #
############
(proxyheaders) {
	# 2022-04-25: https://www.cloudflare.com/ips-v4 & https://www.cloudflare.com/ips-v6
	trusted_proxies private_ranges 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 104.24.0.0/14 172.64.0.0/13 131.0.72.0/22 2400:cb00::/32 2606:4700::/32 2803:f800::/32 2405:b500::/32 2405:8100::/32 2a06:98c0::/29 2c0f:f248::/32
	flush_interval -1
	header_up X-Forwarded-For {vars.realip}
	header_up X-Real-IP {vars.realip}
}
(headers) {
	header {
		Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
		Content-Security-Policy "upgrade-insecure-requests"
		Content-Security-Policy: default-src 'self' *.dulanic.com dulanic.cloudflareaccess.com;
		# X-Frame-Options "SAMEORIGIN"
		X-Content-Type-Options "nosniff"
		X-XSS-Protection "1; mode=block"
		Referrer-Policy "strict-origin-when-cross-origin"
	}
}
(main) {
	tls {$ACMEEMAIL} {
		ca https://acme-v02.api.letsencrypt.org/directory
		dns cloudflare {$CLOUDFLARE_API_TOKEN}
		resolvers 1.0.0.1
	}
	log {
		output file /data/logs/access.log {
			roll_size 100MiB
			roll_keep 10
			roll_keep_for 168h
		}
		format filter {
			wrap json
			fields {
				common_log delete
				request>tls delete
			}
		}
		level error
	}
	respond /robots.txt 200 {
		body "User-agent: *
Disallow: /

User-agent: AdsBot-Google
Disallow: /

User-agent: AdsBot-Google-Mobile
Disallow: /"
		close
	}
}

import subsites

###############
# dulanic.com #
###############
https://dulanic.com {
	import main
	import headers
	root * /www/websites/dulanic.com
	file_server
	# reverse_proxy wordpress3:80 {
	# 	import proxyheaders
	# }

	redir /img /img/
	handle_path /img/* {
		root * /www/img
		file_server
	}
	redir /files /files/
	handle_path /files/* {
		root * /www/files
		file_server
	}
	redir /vid /vid/
	handle_path /vid/* {
		root * /www/vid
		file_server
	}
	redir /ytdl /ytdl/
	handle_path /ytdl/* {
		root * /www/ytdl
		file_server
	}
	redir /icons /icons/
	handle_path /icons/* {
		root * /www/icons
		file_server
	}
	redir /css /css/
	handle_path /css/* {
		root * /www/css
		file_server
	}
}

https://code.dulanic.com {
	import main
	import headers
	reverse_proxy openvscode-server:3000 {
		import proxyheaders
	}
}

https://collabora.dulanic.com {
	import main
	import headers
	reverse_proxy http://collabora:9980 {
		import proxyheaders
	}
}

https://backup.dulanic.com {
	import main
	import headers
	reverse_proxy duplicati:8200 {
		import proxyheaders
	}
}

https://adguard.dulanic.com {
	import main
	import headers
	# import auth
	reverse_proxy http://192.168.2.225 {
		import proxyheaders
	}
}

https://rss.dulanic.com {
	import main
	import headers
	reverse_proxy freshrss:80 {
		import proxyheaders
	}
}

https://overseerr.dulanic.com {
	import main
	import headers
	reverse_proxy overseerr:5055 {
		import proxyheaders
	}
}

https://photos.dulanic.com {
	import main
	import headers
	reverse_proxy photoprism:2342 {
		import proxyheaders
	}
}

https://sonarr.dulanic.com {
	import main
	import headers
	reverse_proxy sonarr:8989 {
		import proxyheaders
	}
}

https://radarr.dulanic.com {
	import main
	import headers
	reverse_proxy radarr:7878 {
		import proxyheaders
	}
}

https://bin.dulanic.com {
	import main
	import headers
	replace stream {
		"</head>" "<link rel='stylesheet' type='text/css' href='https://dulanic.com/css/bin-dark.css'></head>"
	}
	reverse_proxy privatebin:8080 {
		import proxyheaders
	}
}

https://radarr4k.dulanic.com {
	import main
	import headers
	reverse_proxy radarr4K:7878 {
		import proxyheaders
	}
}

https://qbittorrent.dulanic.com {
	import main
	import headers
	reverse_proxy wireguard:8089 {
		import proxyheaders
	}
}

https://irc.dulanic.com {
	import main
	import headers
	reverse_proxy thelounge:9000 {
		import proxyheaders
	}
}

https://grafana.dulanic.com {
	import main
	import headers
	reverse_proxy grafana:3000 {
		import proxyheaders
	}
}

https://homeassistant.dulanic.com {
	import main
	import headers
	reverse_proxy homeassistant:8123 {
		import proxyheaders
	}
}

https://mongo.dulanic.com {
	import main
	import headers
	reverse_proxy mongoclient:3000 {
		import proxyheaders
	}
}

https://organizr.dulanic.com {
	import main
	# import headers
	reverse_proxy organizr:80 {
		import proxyheaders
	}
}

https://paperless.dulanic.com {
	import main
	import headers
	replace stream {
		"</head>" "<link rel='stylesheet' type='text/css' href='https://theme-park.dev/css/base/portainer/organizr.css'></head>"
	}
	reverse_proxy paperless:8000 {
		import proxyheaders
	}
}

https://pgadmin.dulanic.com {
	import main
	import headers
	reverse_proxy pgadmin:5050 {
		import proxyheaders
	}
}

https://pghero.dulanic.com {
	import main
	import headers
	reverse_proxy pghero:8080 {
		import proxyheaders
	}
}

https://phpmyadmin.dulanic.com {
	import main
	import headers
	reverse_proxy phpmyadmin:80 {
		import proxyheaders
	}
}

https://plex.dulanic.com {
	import main
	import headers
	redir /web /web/
	reverse_proxy http://192.168.2.155:32400 {
		import proxyheaders
	}
}

https://portainer.dulanic.com {
	import main
	import headers

	reverse_proxy portainer:9000 {
		import proxyheaders
	}
}

https://recipes.dulanic.com {
	handle_path /media/* {
		root * /media
		file_server
	}

	reverse_proxy recipes:8080 {
		import proxyheaders
	}
}

https://tautulli.dulanic.com {
	import main
	import headers
	reverse_proxy tautulli:8181 {
		import proxyheaders
	}
}

https://readarr.dulanic.com {
	import main
	import headers
	reverse_proxy readarr:8787 {
		import proxyheaders
	}
}

https://teslamate.dulanic.com {
	import main
	import headers
	replace stream {
		"</head>" "<link rel='stylesheet' type='text/css' href='https://dulanic.com/css/teslamate.css'></head>"
	}
	reverse_proxy teslamate:4000 {
		import proxyheaders
	}
}

https://prowlarr.dulanic.com {
	import main
	import headers
	reverse_proxy prowlarr:9696 {
		import proxyheaders
	}
}

https://webmin.dulanic.com {
	import main
	import headers
	reverse_proxy http://192.168.2.155:10000 {
		import proxyheaders
	}
}

https://wiki.dulanic.com {
	import main
	import headers
	reverse_proxy http://wiki:3000 {
		import proxyheaders
	}
}

https://heimdall.dulanic.com {
	import main
	import headers
	reverse_proxy http://heimdall:80 {
		import proxyheaders
	}
}

https://nzbget.dulanic.com {
	import main
	import headers
	reverse_proxy http://nzbget:6789 {
		import proxyheaders
	}
}

https://library.dulanic.com {
	import main
	import headers
	reverse_proxy http://calibre-web:8083 {
		import proxyheaders
	}
}

https://lidarr.dulanic.com {
	import main
	import headers
	reverse_proxy http://lidarr:8686 {
		import proxyheaders
	}
}

https://ytdl.dulanic.com {
	import main
	import headers
	reverse_proxy http://ytdl:8080 {
		import proxyheaders
	}
}

https://dl.dulanic.com {
	import main
	import headers
	reverse_proxy http://filebrowser:8086 {
		import proxyheaders
	}
}

https://redis.dulanic.com {
	import main
	import headers
	reverse_proxy http://redis-commander:8081 {
		import proxyheaders
	}
}

https://teslacam.dulanic.com {
	import main
	import headers
	reverse_proxy http://teslacamviewer {
		import proxyheaders
	}
}

https://nextcloud.dulanic.com {
	import main
	header {
		Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
		Content-Security-Policy "upgrade-insecure-requests"
		Referrer-Policy "strict-origin-when-cross-origin"
	}
	reverse_proxy https://nextcloud:443 {
		transport http {
			tls
			tls_insecure_skip_verify
		}
		import proxyheaders
	}
}

3. The problem I’m having:

HTTP 400, this is the only subdomain this is happening. I can connect without issue using https://serverip:8123, so its connectable.

 dulanic@mediaserver:~/docker/caddy/data/logs$ curl -v https://homeassistant.dulanic.com
*   Trying 192.168.2.155:443...
* Connected to homeassistant.dulanic.com (192.168.2.155) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=homeassistant.dulanic.com
*  start date: Jun 11 21:13:31 2022 GMT
*  expire date: Sep  9 21:13:30 2022 GMT
*  subjectAltName: host "homeassistant.dulanic.com" matched cert's "homeassistant.dulanic.com"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* Using Stream ID: 1 (easy handle 0x561f5c1fce80)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET / HTTP/2
> Host: homeassistant.dulanic.com
> user-agent: curl/7.81.0
> accept: */*
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection state changed (MAX_CONCURRENT_STREAMS == 250)!
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 400
< *.dulanic.com: dulanic.cloudflareaccess.com;
< content-security-policy: upgrade-insecure-requests
< content-type: text/plain; charset=utf-8
< date: Wed, 10 Aug 2022 15:47:18 GMT
< referrer-policy: strict-origin-when-cross-origin
< server: Caddy
< server: Python/3.10 aiohttp/3.8.1
< strict-transport-security: max-age=63072000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-xss-protection: 1; mode=block
< content-length: 16
<
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection #0 to host homeassistant.dulanic.com left intact
400: Bad Request

4. Error messages and/or full log output:

{
  "level": "error",
  "ts": 1660145829.0696774,
  "logger": "http.log.access.log17",
  "msg": "handled request",
  "request": {
    "remote_ip": "192.168.2.50",
    "remote_port": "30522",
    "proto": "HTTP/2.0",
    "method": "GET",
    "host": "homeassistant.dulanic.com",
    "uri": "/favicon.ico",
    "headers": {
      "Cookie": [],
      "Sec-Ch-Ua-Mobile": [
        "?0"
      ],
      "Sec-Ch-Ua-Platform": [
        "\"Windows\""
      ],
      "Accept": [
        "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
      ],
      "Sec-Fetch-Site": [
        "same-origin"
      ],
      "Sec-Fetch-Mode": [
        "no-cors"
      ],
      "Accept-Language": [
        "en-US,en;q=0.9"
      ],
      "Sec-Ch-Ua": [
        "\"Chromium\";v=\"104\", \" Not A;Brand\";v=\"99\", \"Microsoft Edge\";v=\"104\""
      ],
      "Dnt": [
        "1"
      ],
      "User-Agent": [
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.47"
      ],
      "Sec-Fetch-Dest": [
        "image"
      ],
      "Referer": [
        "https://homeassistant.dulanic.com/"
      ],
      "Accept-Encoding": [
        "gzip, deflate, br"
      ]
    }
  },
  "user_id": "",
  "duration": 0.006333751,
  "size": 16,
  "status": 400,
  "resp_headers": {
    "*.dulanic.com": [
      "dulanic.cloudflareaccess.com;"
    ],
    "Referrer-Policy": [
      "strict-origin-when-cross-origin"
    ],
    "Strict-Transport-Security": [
      "max-age=63072000; includeSubDomains; preload"
    ],
    "X-Xss-Protection": [
      "1; mode=block"
    ],
    "Content-Length": [
      "16"
    ],
    "Date": [
      "Wed, 10 Aug 2022 15:37:09 GMT"
    ],
    "Server": [
      "Caddy",
      "Python/3.10 aiohttp/3.8.1"
    ],
    "Content-Security-Policy": [
      "upgrade-insecure-requests"
    ],
    "X-Content-Type-Options": [
      "nosniff"
    ],
    "Content-Type": [
      "text/plain; charset=utf-8"
    ]
  }
}

5. What I already tried:

Tried setting the reverse proxy to https://serverip:8123, also did not work.

Working curl from local ip/port:

dulanic@mediaserver:~/docker/cloudflared$ curl -v http://192.168.2.155:8123
*   Trying 192.168.2.155:8123...
* Connected to 192.168.2.155 (192.168.2.155) port 8123 (#0)
> GET / HTTP/1.1
> Host: 192.168.2.155:8123
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 9294
< Date: Wed, 10 Aug 2022 17:23:13 GMT
< Server: Python/3.10 aiohttp/3.8.1
<
<!DOCTYPE html><html><head><link rel="modulepreload" href="/frontend_latest/core.f2e094cd.js" crossorigin="use-credentials"><link rel="modulepreload" href="/frontend_latest/app.933bd729.js" crossorigin="use-credentials"><meta charset="utf-8"><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="icon" href="/static/icons/favicon.ico"><meta name="viewport" content="width=device-width,user-scalable=no,viewport-fit=cover,initial-scale=1"><style>body{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:400;margin:0;padding:0;height:100%}</style><title>Home Assistant</title><link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#03a9f4"><link rel="apple-touch-icon" sizes="180x180" href="/static/icons/favicon-apple-180x180.png"><meta name="apple-itunes-app" content="app-id=1099568401"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="Home Assistant"><meta name="msapplication-square70x70logo" content="/static/icons/tile-win-70x70.png"><meta name="msapplication-square150x150logo" content="/static/icons/tile-win-150x150.png"><meta name="msapplication-wide310x150logo" content="/static/icons/tile-win-310x150.png"><meta name="msapplication-square310x310logo" content="/static/icons/tile-win-310x310.png"><meta name="msapplication-TileColor" content="#03a9f4ff"><meta name="mobile-web-app-capable" content="yes"><meta name="referrer" content="same-origin"><meta name="theme-color" content="#03A9F4"><meta name="color-scheme" content="dark light"><style>html{background-color:var(--primary-background-color,#fafafa);color:var(--primary-text-color,#212121)}@media (prefers-color-scheme:dark){html{background-color:var(--primary-background-color,#111);color:var(--primary-text-color,#e1e1e1)}}body{font-family:Roboto,Noto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:400;height:100vh;margin:0;padding:0}#ha-launch-screen{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}#ha-launch-screen svg{width:170px;flex-shrink:0}#ha-launch-screen .ha-launch-screen-spacer{flex:1}</style></head><body><div id="ha-launch-screen"><div class="ha-launch-screen-spacer"></div><svg version="1.1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><rect fill="#41bdf5" width="200" height="200" ry="16.4"/><path fill="#fff" d="m38.416 165.29v-53.456h-13.901a3.7332 3.7332 0 0 1-2.662-6.3504l74.804-76.084c1.8068-1.8376 4.7612-1.8628 6.5992-0.056l0.048 0.048 39.04 39.518v-7.3188a3.1112 3.1112 0 0 1 3.1112-3.1112h12.964a3.1112 3.1112 0 0 1 3.1116 3.1112v26.855l16.627 17.047a3.7332 3.7332 0 0 1-2.6728 6.34h-13.954v53.456a3.1112 3.1112 0 0 1-3.1112 3.1112h-116.89a3.1112 3.1112 0 0 1-3.1112-3.1112zm82.556-65.304a6.0116 6.0116 0 0 0 0.584-2.5944c0-3.3232-2.684-6.0172-5.9956-6.0172-3.3112 0-5.9956 2.694-5.9956 6.0172s2.6844 6.0176 5.996 6.0176c0.9256 0 1.802-0.2108 2.5848-0.5868l8.6072 8.6384v8.3672l-10.792 10.831v-7.936a6.0184 6.0184 0 0 0 3.9972-5.6748c0-3.3232-2.6844-6.0176-5.996-6.0176-3.3112 0-5.996 2.6944-5.996 6.0176 0 2.62 1.6688 4.8488 3.9976 5.6748v11.947l-9.9932 10.029v-58.912l8.2076-8.2368a5.9544 5.9544 0 0 0 2.5848 0.5864c3.3116 0 5.996-2.694 5.996-6.0176 0-3.3232-2.6844-6.0172-5.996-6.0172-3.3112 0-5.9956 2.694-5.9956 6.0172 0 0.9292 0.2096 1.8088 0.584 2.5944l-7.3792 7.406-7.3796-7.406a6.0116 6.0116 0 0 0 0.584-2.5944c0-3.3232-2.684-6.0172-5.9956-6.0172-3.3112 0-5.9956 2.694-5.9956 6.0172 0 3.3236 2.6844 6.0176 5.996 6.0176 0.9256 0 1.802-0.2108 2.5848-0.5864l8.2072 8.2368v42.064l-14.39-14.442v-11.546a6.0184 6.0184 0 0 0 3.9972-5.6748c0-3.3236-2.6844-6.0176-5.996-6.0176-3.3112 0-5.996 2.694-5.996 6.0176 0 2.62 1.6688 4.8488 3.9976 5.6748v7.5348l-11.192-11.232v-11.145a6.0184 6.0184 0 0 0 3.9972-5.6748c0-3.3232-2.6844-6.0176-5.996-6.0176-3.3112 0-5.996 2.6944-5.996 6.0176 0 2.62 1.6688 4.8488 3.9976 5.6748v12.807l12.363 12.407h-7.108c-0.8232-2.3372-3.044-4.0116-5.6548-4.0116-3.3112 0-5.996 2.694-5.996 6.0172 0 3.3236 2.6848 6.0176 5.996 6.0176 2.6108 0 4.832-1.6744 5.6548-4.012h11.105l17.216 17.278v30.03l-9.1932-9.2264v-11.546a6.0184 6.0184 0 0 0 3.9972-5.6748c0-3.3232-2.6844-6.0172-5.996-6.0172-3.3112 0-5.996 2.694-5.996 6.0172 0 2.62 1.6688 4.8488 3.9976 5.6748v7.5348l-13.376-13.423a6.0116 6.0116 0 0 0 0.5844-2.5944c0-3.3232-2.684-6.0172-5.996-6.0172-3.3112 0-5.9956 2.694-5.9956 6.0172s2.6844 6.0172 5.996 6.0172c0.9256 0 1.8024-0.2104 2.5848-0.5864l13.376 13.424h-7.108c-0.8232-2.3372-3.044-4.012-5.6548-4.012-3.3112 0-5.996 2.6944-5.996 6.0176s2.6848 6.0172 5.996 6.0172c2.6108 0 4.8316-1.6744 5.6548-4.0116h11.105l11.192 11.232h5.6528l11.592-11.633h10.705c0.8232 2.3368 3.044 4.0112 5.6548 4.0112 3.3112 0 5.996-2.694 5.996-6.0172s-2.6848-6.0172-5.996-6.0172c-2.6108 0-4.8316 1.6744-5.6548 4.0116h-12.361l-10.764 10.802v-13.18l12.82-12.866h20.698c0.8232 2.3372 3.044 4.0116 5.6544 4.0116 3.3116 0 5.996-2.694 5.996-6.0172 0-3.3236-2.6844-6.0176-5.996-6.0176-2.6104 0-4.8312 1.6744-5.6544 4.012h-16.702l11.963-12.006v-10.029l8.6068-8.6384a5.9544 5.9544 0 0 0 2.5852 0.5868c3.3112 0 5.996-2.6944 5.996-6.0176s-2.6848-6.0172-5.996-6.0172-5.996 2.694-5.996 6.0172c0 0.9292 0.21 1.8088 0.5844 2.5944l-5.7804 5.8016v-18.367a6.0184 6.0184 0 0 0 3.9972-5.6748c0-3.3236-2.6844-6.0176-5.996-6.0176-3.3112 0-5.996 2.694-5.996 6.0176 0 2.62 1.6688 4.8488 3.9976 5.6748v18.366l-5.7808-5.8016zm-51.78 57.58c-1.3244 0-2.3984-1.0776-2.3984-2.4068s1.074-2.4068 2.3984-2.4068c1.3248 0 2.3984 1.0776 2.3984 2.4068s-1.0736 2.4068-2.3984 2.4068zm17.588-18.052c-1.3248 0-2.3988-1.0776-2.3988-2.4068s1.074-2.4068 2.3984-2.4068c1.3248 0 2.3984 1.0776 2.3984 2.4068s-1.0736 2.4068-2.3984 2.4068zm-20.786-2.808c-1.3248 0-2.3984-1.0776-2.3984-2.4068s1.0736-2.4068 2.3984-2.4068c1.3244 0 2.3984 1.0776 2.3984 2.4068s-1.074 2.4068-2.3984 2.4068zm-1.9988-20.058c-1.3244 0-2.398-1.0776-2.398-2.4072 0-1.3292 1.0736-2.4068 2.398-2.4068 1.3248 0 2.3984 1.0776 2.3984 2.4068 0 1.3296-1.0736 2.4072-2.3984 2.4072zm49.964 2.808c-1.3244 0-2.398-1.0776-2.398-2.4068 0-1.3296 1.0736-2.4072 2.398-2.4072 1.3248 0 2.3984 1.0776 2.3984 2.4072 0 1.3292-1.0736 2.4068-2.3984 2.4068zm27.181 18.453c-1.324 0-2.398-1.0776-2.398-2.4068 0-1.3296 1.0736-2.4072 2.398-2.4072 1.3248 0 2.3984 1.0776 2.3984 2.4072 0 1.3292-1.0736 2.4068-2.3984 2.4068zm-10.392 19.255c-1.3248 0-2.3984-1.0776-2.3984-2.4068s1.0736-2.4068 2.3984-2.4068c1.3244 0 2.3984 1.0776 2.3984 2.4068s-1.074 2.4068-2.3984 2.4068zm11.192-57.364c-1.3244 0-2.3984-1.078-2.3984-2.4072s1.074-2.4068 2.3984-2.4068 2.3984 1.0776 2.3984 2.4068-1.074 2.4072-2.3984 2.4072zm-13.191-15.645c-1.3244 0-2.3984-1.0776-2.3984-2.4068 0-1.3296 1.074-2.4072 2.3984-2.4072 1.3248 0 2.3984 1.0776 2.3984 2.4072 0 1.3292-1.0736 2.4068-2.3984 2.4068zm-15.989-9.628c-1.3244 0-2.398-1.0772-2.398-2.4068 0-1.3292 1.0736-2.4068 2.398-2.4068 1.3248 0 2.3984 1.0776 2.3984 2.4068 0 1.3296-1.0736 2.4072-2.3984 2.4072zm-25.582 0c-1.324 0-2.398-1.0772-2.398-2.4068 0-1.3292 1.0736-2.4068 2.398-2.4068 1.3248 0 2.3984 1.0776 2.3984 2.4068 0 1.3296-1.0736 2.4072-2.3984 2.4072zm-20.785 9.2268c-1.3244 0-2.3984-1.0776-2.3984-2.4068 0-1.3296 1.074-2.4072 2.3984-2.4072s2.3984 1.0776 2.3984 2.4072c0 1.3292-1.074 2.4068-2.3984 2.4068zm15.189 14.843c-1.3244 0-2.398-1.0776-2.398-2.4068 0-1.3296 1.0736-2.4072 2.398-2.4072 1.3248 0 2.3984 1.0776 2.3984 2.4072 0 1.3292-1.0736 2.4068-2.3984 2.4068zm33.976 1.2036c-1.324 0-2.398-1.078-2.398-2.4072s1.0736-2.4068 2.398-2.4068c1.3248 0 2.3984 1.0776 2.3984 2.4068s-1.0736 2.4072-2.3984 2.4072z"/></svg><div id="ha-launch-screen-info-box" class="ha-launch-screen-spacer"></div></div><home-assistant></home-assistant><script>function _ls(e){var t=document.documentElement,i=t.insertBefore(document.createElement("script"),t.lastChild);return i.defer=!0,i.src=e,i}window.Polymer={lazyRegister:!0,useNativeCSSProperties:!0,dom:"shadow",suppressTemplateNotifications:!0,suppressBindingNotifications:!0},window.polymerSkipLoadingFontRoboto=!0,"customElements"in window&&"content"in document.createElement("template")||document.write("<script src='/static/polyfills/webcomponents-bundle.js'><\/script>");var isS11_12=/(?:.*(?:iPhone|iPad).*OS (?:11|12)_\d)|(?:.*Version\/(?:11|12)(?:\.\d+)*.*Safari\/)/.test(navigator.userAgent)</script><script>function _pf(o,t){var n=document.createElement("link");n.rel="preload",n.as="font",n.type="font/woff2",n.href=o,n.crossOrigin="anonymous",document.head.appendChild(n)}-1===navigator.userAgent.indexOf("Android")&&-1===navigator.userAgent.indexOf("CrOS")&&(_pf("/static/fonts/roboto/Roboto-Regular.woff2"),_pf("/static/fonts/roboto/Roboto-Medium.woff2"))</script><script crossorigin="use-credentials">isS11_12||(import("/frontend_latest/core.f2e094cd.js"),import("/frontend_latest/app.933bd729.js"),window.customPanelJS="/frontend_latest/custom-panel.228367ca.js",window.latestJS=!0,window.globalThis||(window.globalThis=window))</script><script></script><script>window.latestJS||(window.customPanelJS="/frontend_es5/custom-panel.9875c7eb.js",_ls("/frontend_es5/core.5407379b.js"),_ls("/frontend_es5/app.267f38e0.js"))</script><script>if (!window.latestJS) {
* Connection #0 to host 192.168.2.155 left intact
        }</script></body></html>

6. Links to relevant resources:

I think you need to configure Home Assistant to trust requests coming from Caddy (similar to Caddy’s trusted_proxies). See their docs:

1 Like

Yes, that is setup already. It used to work, and then it stopped so I got confused. I will follow up /w a post to their area.

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.0.0.0/8
    - ::1

I checked the HA log, and it shows this error…


2022-08-11 11:47:27.080 ERROR (MainThread) [homeassistant.components.http.forwarded] Invalid IP address in X-Forwarded-For:

This is messing it up then. Remove this. Caddy sets the XFF headers appropriately, automatically.

2 Likes

Thank you, that fixed it!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.