Skip to content

Commit 9595e1f

Browse files
docs(agents): note Vite IPv4 bind and Spring CORS loopback hosts
Cloud VM gotchas: Vite can bind ::1-only without --host 0.0.0.0, and CORS_ALLOWED_ORIGINS must include both localhost and 127.0.0.1 for Agent. Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
1 parent 2ead918 commit 9595e1f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,19 @@ only covers cloud-specific, non-obvious caveats.
177177
Redis degrades gracefully but the local `.env` points at it.
178178
- **Backend** (port 8080, base path `/api`): `bash scripts/start-backend.sh` (wraps
179179
`./mvnw spring-boot:run`; it strips `SPRING_PROFILES_ACTIVE=prod` for local runs → dev mode).
180+
<<<<<<< HEAD
180181
- **Frontend** (port 3000): `npm run dev` (Vite proxies `/api` → 8080 and `/agent-api` → 8787).
181182
- **DeepSQL Agent API** (port 8787, optional): needed for the sidebar **Agent** tab.
182183
Runtime is a customized Nous Hermes Agent; see caveats below for install +
183184
`HERMES_WEBUI_ALLOWED_ORIGINS` (upstream env name).
185+
=======
186+
- **Frontend** (port 3000): prefer `npx vite --host 0.0.0.0 --port 3000` (or `npm run dev`
187+
with `server.host` set). Plain `npm run dev` can bind **IPv6-only** (`::1:3000`) in this
188+
VM so `curl http://127.0.0.1:3000` fails even though Vite looks healthy. Vite proxies
189+
`/api` → 8080 and `/agent-api` → 8787.
190+
- **Hermes Agent webui** (port 8787, optional): needed only for the sidebar **Agent** tab.
191+
See caveats below for install + `HERMES_WEBUI_ALLOWED_ORIGINS`.
192+
>>>>>>> 7dacaac (docs(agents): note Vite IPv4 bind and Spring CORS loopback hosts)
184193
- A demo target DB `demo_shop` (same Postgres server, sample `customers`/`products`/`orders`)
185194
exists for exercising connection/schema features without an external database.
186195

@@ -232,7 +241,19 @@ only covers cloud-specific, non-obvious caveats.
232241
`http://deepsql-agent:8788/provision`) with `AGENT_PROVISION_SECRET`. In this VM run
233242
`python3 scripts/local-agent-provisioner.py` (needs those two env vars in `.env`).
234243
Without it, Spring logs `agent.provision-secret is unset — skipping…` and the
244+
<<<<<<< HEAD
235245
`u-admin` agent profile is never created/token-refreshed.
246+
=======
247+
`u-admin` Hermes profile is never created/token-refreshed.
248+
- **Hermes webui Origin allowlist for Vite.** Start Hermes with
249+
`HERMES_WEBUI_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000` or browser
250+
requests via the Vite `/agent-api` proxy return **403** "Cross-origin mismatch".
251+
Webui listens on `:8787`.
252+
- **Spring CORS must allow both loopback hosts.** Set
253+
`CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000` in `.env`. Opening
254+
the UI as `http://127.0.0.1:3000` while only `localhost` is allowlisted yields **403**
255+
on `POST /api/agent/session` (and other cookie-auth APIs).
256+
>>>>>>> 7dacaac (docs(agents): note Vite IPv4 bind and Spring CORS loopback hosts)
236257
- **Before running backend tests that boot the Spring context** (e.g. `ApiSmokeTest`), stop
237258
the running backend first — both use `ddl-auto=update` on the same `dba_agent` DB and can
238259
deadlock on an `ALTER TABLE`. Test env vars are documented in `CLAUDE.md` (Testing).

0 commit comments

Comments
 (0)