Skip to content

fix(frontend): skip the trailing-slash redirect and forward DELETE bodies in the API proxy - #121

Merged
klin2686 merged 2 commits into
mainfrom
fix/api-trailing-slash-redirect
Oct 16, 2026
Merged

klin2686 merged 2 commits into
mainfrom
fix/api-trailing-slash-redirect

Conversation

@klin2686

@klin2686 klin2686 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  1. Every API call from the browser was getting a 308 before it reached the proxy, because Next.js redirects paths ending in / and every path in lib/api.ts ends in one. This removes that extra round trip.
  2. Deleting your own account always failed with a 422, because the proxy route dropped DELETE request bodies and DELETE /users/me/ needs the password in the body.

What changed

Frontend

  • request() in lib/api.ts strips the trailing slash (before any query string) when calling /api/proxy; the proxy route already adds it back before forwarding to FastAPI.
  • Requests made with NEXT_PUBLIC_API_URL set keep the slash, since they hit FastAPI directly and it has redirect_slashes=False.
  • The proxy route in app/api/proxy/[...path]/route.ts now forwards the request body for DELETE, not just POST, PUT and PATCH. An empty body is still sent as no body.

Test plan

Manual

  • 15 GET routes (tournament, events, members, shifts, tracks, assignments, audit log, roles, etc.) return identical status and body with and without the trailing slash, with no redirect on the new form.
  • DELETE /users/me/ with a wrong password now returns 401 Current password is incorrect instead of 422 body: Field required.
  • A DELETE without a body (/users/me/volunteer-experience/999999/) still returns 404 as before.

@railway-app

railway-app Bot commented Oct 16, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @klin2686 does not have access to the Railway project.

In order to get automatic PR deploys, please add @klin2686 to your workspace on Railway.

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nexus Ready Ready Preview Oct 16, 2026 6:34am UTC

@klin2686
klin2686 force-pushed the fix/api-trailing-slash-redirect branch from 132958b to c0d6120 Compare October 16, 2026 06:05
@klin2686 klin2686 changed the title fix(frontend): skip the trailing-slash redirect on proxied API requests fix(frontend): skip the trailing-slash redirect and forward DELETE bodies in the API proxy Oct 16, 2026
@klin2686
klin2686 force-pushed the fix/api-trailing-slash-redirect branch from 0311676 to 76baff1 Compare October 16, 2026 06:33
@klin2686
klin2686 merged commit 0ec9841 into main Oct 16, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 76baff1b Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant