diff --git a/docs/DEPLOY_FROM_SCRATCH.md b/docs/DEPLOY_FROM_SCRATCH.md index c3c1f05..5b4d8ea 100644 --- a/docs/DEPLOY_FROM_SCRATCH.md +++ b/docs/DEPLOY_FROM_SCRATCH.md @@ -314,15 +314,7 @@ curl -sS http://127.0.0.1:3001/api/health ## Step 11 — Reverse Proxy Setup (HTTPS via Caddy/nginx) -If you're using a reverse proxy (Caddy, nginx, etc.) to serve the application over HTTPS, you need to configure it to route `/api/*` requests to the backend **before** serving static files. - -### Issue: API requests returning HTML instead of JSON - -**Symptom:** Login works but navigation tabs don't show, or API calls return HTML (the frontend's `index.html`) instead of JSON data. - -**Cause:** The reverse proxy is serving static files for all requests, including `/api/*` requests, instead of forwarding them to the backend. - -### Solution: Configure proxy to route `/api/*` first +If you're using a reverse proxy (Caddy, nginx, etc.) to serve the application over HTTPS, configure it to route `/api/*` requests to the backend **before** serving static files. The proxy must forward `/api/*` requests to the backend (port 8000) **before** trying to serve static files. @@ -409,11 +401,8 @@ This allows the frontend to use relative API paths (`/api/v1/...`) that work cor ## Common fixes -### API requests return HTML instead of JSON (reverse proxy issue) +### API requests return HTML instead of JSON -**Symptom:** Browser console shows API responses are HTML (the frontend's `index.html`) instead of JSON. Login may work but navigation tabs don't appear. - -**Solution:** 1. Ensure your reverse proxy (Caddy/nginx) routes `/api/*` requests to the backend **before** serving static files (see Step 11 above). 2. Verify `admin-frontend/.env` has `VITE_API_URL=` (empty) when using a proxy. 3. Rebuild the frontend after changing `.env`: `cd admin-frontend && npm run build && pm2 restart punimtag-admin`