Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Routing] Trailing slash redirection prevents routes to be matched #32996

Copy link
Copy link
Closed
@Jean-Gian

Description

@Jean-Gian
Issue body actions

Symfony version(s) affected: 4.3.3

Description
When using yaml to configure routes, if I have 2 routes that only differs on the trailing slash (/foo and /foo/) only the first one in the yaml file works, the second one always redirect to the first one.
This happens with hard coded routes (/foo) or with wildcards (/{param})
The documentation says this should not happen: https://symfony.com/doc/current/routing.html#routing-trailing-slash-redirection

How to reproduce
The routing yaml file is:

foo_slash: #working
  path:       /foo/
  controller: App\Controller\Slash:foo
foo_no_slash: #not working, redirecting to foo_slash
  path:       /foo
  controller: App\Controller\NoSlash:foo
bar_no_slash: #working
  path:       /bar
  controller: App\Controller\NoSlash:bar
bar_slash: #not working, redirecting to bar_no_slash
  path:       /bar/
  controller: App\Controller\Slash:bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.