Apache Reverse Proxy with ESPHome not working

Wanted to see what I needed to get Apache working with ESPHome in a Reverse Proxy setup. It looks like this is the only app that does not like the HTTPS setup.

I have followed the guide below, and it seems to work for everything else but ESPHome:

I have also looked at the following issue, which is what led me to check my Apache configuration:

I am getting the following error in my ESPHome logs when viewing my node logs:
WARNING 400 GET /logs (0.0.0.0) 1.66ms

1 Like

Hello!

Add this line above your ProxyPass line in Apache config:
ProxyPreserveHost On

I have forwarded port 8123 from HA via ssh port forward to my server.
My current vhost apache config in ispconfig (Apache Directives) looks like this:

RewriteEngine on

RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/
RewriteRule ^ - [END]

RewriteCond %{HTTP_HOST}   ^YOUR_HOST$ [NC]
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule ^/?(.*)  ws://127.0.0.1:8123/$1 [P,L] 

ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:8123/"
ProxyPassReverse "/" "http://127.0.0.1:8123/"

Hope this helps!