awslabs / awslabs/agentcore-samples
06-workshops - [Bug] 07-Temporal Policies: Redirect loop when setting Vite base to /app/5173/
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
**In which component is this bug present?**
- [ ] 01-AgentCore-runtime
- [x] 02-AgentCore-gateway
- [ ] 03-AgentCore-identity
- [ ] 04-AgentCore-memory
- [ ] 05-AgentCore-tools
- [ ] 06-AgentCore-observability
- [ ] 07-AgentCore-E2E
**Bug Description**
Symptom: "The page isn't redirecting properly"
Setting `base: "/app/5173/"` in vite.config.ts fixes asset URLs in HTML, but also makes Vite's dev server enforce that base path. Since nginx strips `/app/5173/` before forwarding:
1. Browser → `GET /app/5173/` → nginx strips prefix → sends `GET /` to Vite
2. Vite sees `GET /` doesn't match base `/app/5173/` → responds 302 → `/app/5173/`
3. Browser follows redirect → `GET /app/5173/` → back to step 1 → infinite loop
**Suggested Fix**
Use `base: "./"` instead and build the app with `npx vite build` rather than using the Vite dev server. Serve the static build with a simple Node.js server.
Contributor guide
Assessment
This issue has not been assessed yet.