How to set Apache2 to forward from subdirectory to localhost:port?

by Ekci   Last Updated October 17, 2018 19:00 PM

I am hosting a https://home-assistant.io on my home server and can access it by http://example.net:8123. What I now want to do now is to access it by entering http://example.net/ha, I have found a .conf that might be a starting point but I cannot make it work from subdirectory:

<VirtualHost *:80>
  ServerName home.example.org
  ProxyPreserveHost On
  ProxyRequests off
  ProxyPass /api/websocket ws://localhost:8123/api/websocket
  ProxyPassReverse /api/websocket ws://localhost:8123/api/websocket
  ProxyPass / http://localhost:8123/
  ProxyPassReverse / http://localhost:8123/

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)  ws://localhost:8123/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /(.*)  http://localhost:8123/$1 [P,L]
</VirtualHost>```

I have tried a few different configurations whit /ha added at the beginning of all paths in this snippet but it's still now working. Any tips on how to make it working Apache?



Related Questions


Apache is not accesible from Internet

Updated July 31, 2017 19:00 PM



Server Management

Updated May 10, 2017 04:00 AM

Apache2 Configuration

Updated July 22, 2018 14:00 PM