V1.32.1: the API can live under the site's own address

- Live updates connect to the path the API sits under (such as /api behind
  the site's own nginx), not only to an API on a host of its own: Socket.io
  reads a URL's path as a namespace, so the path now goes into its `path`
- README: how to serve the API under the site's address (.env values and
  the nginx location block)
- All packages at version 1.32.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 23:41:43 +02:00
co-authored by Claude Opus 5.5
parent 4bd301182b
commit c37349587c
6 changed files with 41 additions and 8 deletions
+27
View File
@@ -106,6 +106,9 @@ including a character sheet or an encounter) and **Account**.
items) and by level in the class that gives them.
- **Armor holds Dexterity back** as in the rules: all of it counts toward AC
in light armor, at most +2 in medium, none in heavy.
- **The API can live under the site's own address**, such as `/api`
behind the same nginx, as well as on a host of its own (see "Serving the
API under the site's address").
- **Battles that keep to the fight.** While a battle is under way the scene
description shows only between rounds, cards' details start closed (the
spotlight, or on a phone the card on turn, has them), and the DM's setup,
@@ -234,6 +237,30 @@ old data model and pages that use anything new fail to load (for example
"Could not load this encounter"). Change your password from the account page
("Account" in the navigation).
### Serving the API under the site's address
The API can sit on its own host or under a path of the site, such as
`https://example.com/api`. For the second, set `VITE_API_URL=/api` in
`frontend/.env` before building (Vite bakes it in), set `CORS_ORIGIN` in
`backend/.env` to the site's address, and pass the path on in the site's
nginx config:
```nginx
location /api/ {
proxy_pass http://127.0.0.1:4000/; # the trailing slash strips /api
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600s;
}
```
The backend keeps seeing `/auth`, `/campaigns` and `/socket.io/` as before;
the live updates connect to `/api/socket.io`.
## Tests
```bash