Reverse Proxy HA with Apache

I already have an Apache web server that manages the communication between the different services and websites as a reverse proxy.

The Apache web server also handles the SSL certificates and resolves them to an unencrypted connection within the LAN.

The configuration file is used:
Here the relevant section.

# ---------------------------
# ---------------------------

<virtualhost *:80>
	redirect permanent /

<virtualhost *:443>

    rewriteengine on
    rewriterule ^/(.*)$1 [p,l]
	sslengine on
	sslcertificatefile  "conf/ssl/"
	sslcertificatekeyfile "conf/ssl/"
	# not in use because of url rewrite
    documentroot "w:/www/home"

Similar sections are currently in use to reverse proxy to different LAN servers and on different ports and there everything works fine.

However accessing HA over the internet will lead to an error
400: Bad request

I also entered the public domain to
HA → Settings → System → Network → Home Assistant URL
set it to:

Any ideas what is going on?


There is a bit more configuration required - especially proxying websocket requests is essential for the reverse proxy to work. This thread should help:

The “400: Bad request” can be fixed by adding your proxy server’s ip as a trusted proxy in home assistant’s configuration.yaml file.


  ip_ban_enabled: True
  login_attempts_threshold: 5
  use_x_forwarded_for: true