Description
Web portal routes 404 when the URL has a trailing slash. The same path without the slash works.
Steps to reproduce
- Open
https://trackslash.com/badbundle/projects/(trailing slash). - Open
https://trackslash.com/badbundle/projects(no trailing slash).
Expected
Both resolve to the same page. The trailing-slash form should redirect to the canonical no-slash URL.
Actual
| URL | Status |
|---|---|
/badbundle/projects/ |
404 |
/badbundle/projects |
200 |
Notes
Router() in internal/server/server.go:118 builds the chi router with no slash-handling middleware, so chi treats the two paths as distinct routes.
middleware.RedirectSlashes gives a canonical 301 to the no-slash form, which is the right behaviour for portal pages. Scope it to the web portal route group rather than mounting it globally: a 301 on a POST can cause clients to retry as GET, and the /mcp and JSON API routes should not have their paths rewritten underneath them.
Cover both the redirect and the untouched API/MCP behaviour with handler tests.
Sub-issues
0Linked issues
0GitHub
0No branches or pull requests linked.