Cybersecurity-Projects/PROJECTS/beginner/canary-token-generator
CarterPerez-dev 915d471b8d fix(canary): vite dev proxy — correct backend port + stop stripping /api
Two latent template-leftover bugs in vite.config.ts proxy that 404'd every
useTokenTypes/useCreateToken/useManageToken/useDeleteToken call:

- Default target was http://localhost:8000. Backend listens on :8080
  (backend/config.yaml `server.port: 8080`, default registered in
  internal/config/config.go). Off-by-one-port silent for the whole
  Phase 14 cycle because Phase 14 didn't end-to-end-test.

- `rewrite: (p) => p.replace(/^\/api/, '')` stripped /api before forwarding.
  But backend mounts routes UNDER /api via `r.Route("/api", ...)`
  (cmd/canary/main.go:322). So a request for /api/tokens/types got rewritten
  to /tokens/types, which backend doesn't serve — 404 page not found.

Frontend axios uses baseURL `/api` and path `/tokens/types` → full URL
`/api/tokens/types`. With these fixes the proxy now passes that through
verbatim to http://localhost:8080/api/tokens/types, which is where chi
actually mounts the route.

dev.compose.yml: added VITE_API_TARGET=http://canary:8080 to the frontend
container's env so the dev-compose path also works (inside the container
"localhost" is the vite container, not the canary container — has to use
docker DNS).

Surfaced today when the operator manually eyeballed the landing page and
SpeciesSection rendered "Could not load species catalog. Try again in a
moment." (the descriptorsError branch in landing/index.tsx SpeciesSection).
2026-05-17 17:37:36 -04:00
..
backend fix(canary-phase13): direct unit coverage for firstSubdivisionName 2026-05-17 05:30:13 -04:00
frontend fix(canary): vite dev proxy — correct backend port + stop stripping /api 2026-05-17 17:37:36 -04:00
infra fix(canary-phase1): clear all post-phase-1 audit observations + header normalization 2026-05-10 06:15:26 -04:00
scripts fix(canary-phase1): clear all post-phase-1 audit observations + header normalization 2026-05-10 06:15:26 -04:00
.env.example fix(canary-phase0): address audit findings before phase rollup 2026-05-10 05:37:32 -04:00
.gitignore chore(canary): expand project .gitignore for Go + Node + secrets 2026-05-10 05:13:19 -04:00
cloudflared.compose.yml fix(canary-phase0): address audit findings before phase rollup 2026-05-10 05:37:32 -04:00
compose.yml fix(canary-phase1): clear all post-phase-1 audit observations + header normalization 2026-05-10 06:15:26 -04:00
dev.compose.yml fix(canary): vite dev proxy — correct backend port + stop stripping /api 2026-05-17 17:37:36 -04:00
justfile feat(canary): unified Justfile with frontend + backend + compose groups 2026-05-10 05:25:27 -04:00