-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Missing redirection when route param does not accept trailing slash #30863
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
Labels
Comments
Related to #30013 |
This was referenced Apr 10, 2019
Closed
Fixed in #31107 |
fabpot
pushed a commit
that referenced
this issue
Apr 17, 2019
…railing vars (nicolas-grekas) This PR was merged into the 4.2 branch. Discussion ---------- [Routing] fix trailing slash redirection with non-greedy trailing vars | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30863, #31066 | License | MIT | Doc PR | - Fixes redirecting `/123/` to `/123` when the route is defined as `/{foo<\d+>}` Commits ------- d88833d [Routing] fix trailing slash redirection with non-greedy trailing vars
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected: 4.2.4
Description
Symfony 4 does not redirect in a route ending with a param which does not accept a trailing slash. Route can disallow a trailing slash if configured as shown here. Symfony 4 should detect that the route is invalid with a trailing slash (but valid without it) and so return a redirect response to the same route without the slash.
How to reproduce
Step 1. Set your route
Step 2. Implement the action
Step 3. Serve the application and visit the path
http://127.0.0.1:8000/check/123/
The output is the one it would provide without the slash:
token is 123
But we want it to actually be redirected to
http://127.0.0.1:8000/check/123
, which is the only valid one, already working and returning the same exact response.Additional context
Route-related log is identical in both cases (i.e., with and without the trailing slash):
[2019-04-04 09:50:35] request.INFO: Matched route "test". {"route":"test","route_parameters":{"_route":"test","token":"123","_controller":"AppBundle\\Controller\\DefaultController::tokenAction"},"request_uri":"http://127.0.0.1:8000/check/123/","method":"GET"} []
PS: Example heavily based on #29924, which seems somewhat related to this issue
The text was updated successfully, but these errors were encountered: