Reverse proxy to an url, not sub-domain ( instead of


I cannot manage to set up my reverse proxy to home-assistant, following the Apache2 guide and just changing the root context to a sub context (/hass in my case).

Did any one achieve that?


Any one? :smiley:

Did you try some Google time :wink: Here’s one possible hint, and here’s another.

Actually, I’m not exactly a newcomer when it comes to reverseproxying stuff to subfolders :wink:

So i know how to do it, and actually the links you pointed me to (thanks by the way!) are merely describing the normal way.

But I think it’s just not possible as I just noticed home-assistant doesn’t have a configurable web root.

Hi guys. I’m running an apache server as an HTTPS proxy and I figured out a few workarounds for issues encountered when configuring Apache. This configuration addresses the following issues:

  • External proxy to internal IP
  • HTTP redirect to HTTPS configuration
  • Wrong IP Address showed in login notifications within Home Assistant
  • Websockets don’t work properly
  • Addons don’t work
<VirtualHost *:80>
        ServerName #MODIFY to your host name
        ServerAdmin       [email protected] #MODIFY to your email
        RewriteEngine On
        # This will enable the Rewrite capabilities
        RewriteCond %{HTTPS} !=on
        # This checks to make sure the connection is not already HTTPS
        RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

<IfModule mod_ssl.c>
<VirtualHost *:443>

		#Declare server
        ServerName #MODIFY to your host name
        ServerAdmin       [email protected] #MODIFY to your email

        #fix detecting incorrect login IP by proxy server
        RemoteIPInternalProxy  #MODIFY to your proxy, or delete if you aren't using a firewall
        RemoteIPHeader X-Forwarded-For

        #proxy server setup
        ProxyPreserveHost On
        ProxyRequests Off
        ProxyPass /api/websocket ws:// #MODIFY to your HA IP:Port
        ProxyPassReverse /api/websocket wss:// #MODIFY to your HA:Port
        ProxyPass / #MODIFY to your HA IP:Port
        ProxyPassReverse / #MODIFY to your HA IP:Port

        #fix websockets for addons and apis
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule ^/?(.*) "ws://$1" [P,L] #MODIFY to your HA IP address

        #Set security on certan areas(some redacted)
        <Location "/">
                Satisfy any
#               Include /path/to/mySecuritySettings.conf
        <Location "/api">
                Satisfy any

        #HTTPS certs
#        Include /path/to/sites-available/ssl.conf
#        Include /path/to/options-ssl-apache.conf
#        SSLProxyEngine On
#        SSLCertificateFile /path/to/my-chain.pem
#        SSLCertificateKeyFile /path/to/my-cert.pem