Serve the panel from a sub-path, and an Apache conf for /heos
The app assumed it lived at the server root: its links were /static/... and its fetches /api/..., which behind a proxy at /heos resolve to the wrong place, so the page would load and nothing on it would work. It now takes the prefix from X-Forwarded-Prefix, and everything it generates -- stylesheet, icons, the manifest's start_url, every fetch -- follows. Nothing changes when it is served from its own port. deploy/heos.conf is the Apache side, restricted to the local network by default, since this controls the speakers and the vhost it hangs off has a public certificate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,35 @@ WantedBy=multi-user.target
|
||||
sudo systemctl enable --now heos-panel
|
||||
```
|
||||
|
||||
## Behind Apache, at /heos
|
||||
|
||||
`deploy/heos.conf` reverse-proxies `/heos` to the panel:
|
||||
|
||||
```bash
|
||||
sudo a2enmod proxy proxy_http headers
|
||||
sudo cp deploy/heos.conf /etc/apache2/conf-available/heos.conf
|
||||
sudo a2enconf heos
|
||||
sudo apachectl configtest && sudo systemctl reload apache2
|
||||
```
|
||||
|
||||
It ships restricted to the local network — it controls the speakers, and
|
||||
it usually hangs off a vhost with a public certificate. Delete the
|
||||
`RequireAny` block to open it up.
|
||||
|
||||
The app works at either address without being told which. Apache sends
|
||||
`X-Forwarded-Prefix: /heos`, and every URL the app generates — stylesheet,
|
||||
icons, the manifest's `start_url`, every `fetch` — picks up that prefix.
|
||||
Serve it straight from port 5005 and the same URLs come out as `/...`.
|
||||
That header is what the `headers` module is for; without it the page loads
|
||||
and nothing on it works.
|
||||
|
||||
Two things worth knowing:
|
||||
|
||||
- The `<Location>` block takes `/heos` away from the filesystem, so the
|
||||
source under `/var/www/html/heos` stops being served as static files.
|
||||
- The panel still answers directly on `<pi-ip>:5005`. Start it with
|
||||
`--host 127.0.0.1` if you want Apache to be the only way in.
|
||||
|
||||
## How the grouping actually works
|
||||
|
||||
Worth knowing, because HEOS makes two things easy to get wrong.
|
||||
|
||||
Reference in New Issue
Block a user