Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Filter to handle URLs with trailing slashes #31366

Closed
rstoyanchev opened this issue Oct 5, 2023 · 6 comments
Closed

Create Filter to handle URLs with trailing slashes #31366

rstoyanchev opened this issue Oct 5, 2023 · 6 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

Matching URLs with a trailing slash was deprecated in 6.0 in favor of early handling via proxy or Filter like UrlRewriteFilter, see #28552 for details. The continued feedback on the issue, however, makes it clear we need to go further and provide built-in support.

This can be a Filter ordered as early as possible, e.g. ahead of security, that handles URLs with a trailing slash. One option is a permanent redirect, and another is to rewrite the request like UrlRewriteFilter. This can be configurable by URL pattern or for all requests. Another suggestion from #28552 (comment) is to log URLs with a trailing slash in order to discover and phase them out.

@thammaratNak1
Copy link

why does'n support trailing slash by default same as version before ?

@SebasAnasco1517
Copy link

Hi,
there any news for this Filter built-in solution? On my company we migrated to SpringBoot 3 and found the 404 problem from the deprecation of trailing slash.

Have a good one, God bless you.

@ericdriggs
Copy link

@SebasAnasco1517
Workaround is setUseTrailingSlashMatch.
I'm using it in several projects

#28552 (comment)

@rstoyanchev
Copy link
Contributor Author

rstoyanchev commented May 15, 2024

I've added UrlHandlerFilter in edb6bb7 that will be in 6.2.0 snapshots shortly, and in the M2 release tomorrow. Early feedback towards further 6.2 milestones would be much appreciated!

There is no WebFlux equivalent yet, but I've created #32830 for M3 to keep track of that.

@kundan621
Copy link

@rstoyanchev can you please also tell how to use this? Do you have any documentation or Blog post for this?

@bclozel
Copy link
Member

bclozel commented Oct 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants