alby-hub/scripts/caddy-subpath/README.md
Roland 51ce7c64a0
Feat: allow hosting alby hub on subpath (#1439)
* feat: add base path to front end

- add docker build arg to set base path frontend is served under
- set vite.config.ts base value based on docker build arg
- update http variant request function to inject base path during calls to /api and /images
- update how static assets are loaded from public folder to inject base path during vite build

To use a base path build the docker image with --build-arg BASE_PATH=/hub/.
All assets and api calls from the frontend will use that base path as prefix.

The backend service is not using the base path, when using a proxy the base path has to be stripped.

* chore: simplify base path usage and add extra documentation

* chore: add extra documentation

---------

Co-authored-by: 8de2fdb0 <89734465+8de2fdb0@users.noreply.github.com>
2025-06-26 16:23:40 +05:30

486 B

Caddy Subpath

This is an example of how to run Alby Hub on a subpath using Caddy

To test locally edit sudo nano /etc/hosts and add 127.0.0.1 your-domain.com

Use the following environment variables when building the frontend:

BASE_PATH="/example-path" yarn build:http

Then run Alby Hub as normal. (if default port is not 8080 you will need to update the Caddyfile)

Then start caddy: sudo caddy run -c ./Caddyfile

and visit `http://your-domain.com/example-path