macOS Server Service Proxy reverse proxy request for specific host
1
vote
0
answers
137
views
Reverse Proxy for Home Assistant with macOS Server 5.3.1
Created a website within Server App for EXTERNALHOSTNAME.TLD
Selected SSL Certificate for EXTERNALHOSTNAME.TLD
Enabled web app in Advanced Settings
This webapp/reverseproxy setup works and Home Assistant is working as expected with no functional issues via macOS Server, **BUT**, the catch is that any request matching “/api/websocket” is reverse proxied through to home assistant, for any other hostnames, which isn’t ideal.
I cant figure out how to configure this upstream Service Proxy to apply this reverse proxy for /api/websocket only for the external hostname for home assistant and not reverse proxy it for all other hostnames.
Any pointers on how to get the websocket reverse proxy set up correctly just for the relevant hostname?
The three files configured for this to work are as follows;
**Webapp PLIST file** /Library/Server/Web/Config/apache2/webapps/EXTERNALHOSTNAME.ha_webapp.plist;
includeFiles
/Library/Server/Web/Config/apache2/httpd_ha_webapp.conf
name
EXTERNALHOSTNAME.ha_webapp
displayName
ReverseProxy - HomeAssistant
installationIndicatorFilePath
/Library/Server/Web/Config/apache2/httpd_ha_webapp.conf
sslPolicy
0
**Webapp CONF file** /Library/Server/Web/Config/apache2/httpd_ha_webapp.conf;
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://INTERNALHOSTNAME:8123/
ProxyPassReverse / http://INTERNALHOSTNAME:8123/
**MacOS Server Service Proxy CONF file** /Library/Server/Web/Config/Proxy/apache_serviceproxy_customsites_ha.conf
ProxyPass /api/websocket ws://INTERNALHOSTNAME:8123/api/websocket
ProxyPassReverse /api/websocket ws://INTERNALHOSTNAME:8123/api/websocket
Asked by Tim Apple
(119 rep)
Jan 2, 2023, 12:11 PM