Skip to content

fix: return 404 instead of 301 for trailing slash (issue #245)#257

Merged
devfeel merged 2 commits intoaicodefrom
aicode-fix-trailing-slash
Mar 1, 2026
Merged

fix: return 404 instead of 301 for trailing slash (issue #245)#257
devfeel merged 2 commits intoaicodefrom
aicode-fix-trailing-slash

Conversation

@devfeel
Copy link
Copy Markdown
Owner

@devfeel devfeel commented Mar 1, 2026

Description

Fix issue #245: URL with trailing slash /hello/xx/ should return 404 instead of 301 redirect when matching route /hello/:name

Changes

  • Set RedirectTrailingSlash to false in router initialization
  • Now returns 404 like net/http does

Testing

Verified with curl:

  • Before: curl /hello/xx/ → 301 Moved Permanently
  • After: curl /hello/xx/ → 404 Not Found

@devfeel
Copy link
Copy Markdown
Owner Author

devfeel commented Mar 1, 2026

commit

@devfeel devfeel merged commit 6479741 into aicode Mar 1, 2026
1 check failed
@devfeel devfeel deleted the aicode-fix-trailing-slash branch March 1, 2026 08:28
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