<p dir="auto"><strong>Symfony version(s) affected</strong>: 4.1.8+</p>
<p dir="auto"><strong>Description</strong></p>
<p dir="auto">Symfony now redirects routes with trailing slashes to routes without trailing slashes on its own, which seems unexpected and like a bad practice, as two URLs are treated equally which are not automatically equal by any official standards.</p>
<p dir="auto">URLs in my application never have a trailing slash, and if a link points towards an URL with a trailing slash this should always be treated as a 404, which can then be captured and logged by my application to find out why there was an incorrect link. Symfony now decides on its own that an URL followed by a slash is equal to the same URL without the trailing slash and does an additional redirect, which seems like an arbitrary convention and is a BC break.</p>
<p dir="auto">I also feel Symfony doing redirects bypassing the application is unexpected in its own way - I expect routes to be matched, but not Symfony to decide how to redirect URLs and changing my URLs. In my case this broke part of my application, because suddenly there was an additional unexpected redirect which was not issued by my application but by Symfony itself.</p>
<p dir="auto"><strong>Possible Solution</strong></p>
<p dir="auto">As far as I can tell there is no way for me to bypass this functionality - no option to switch it off, nothing to do (I went through all Symfony documentation, and this now seems to be required behavior). Generally, I want to turn off ANY automatic redirection of Symfony, as this is the responsibility of my application.</p>
<p dir="auto">So if this change really needs to happen, then there should be a possibility to turn it off. There might also be possibilities to make the router more succinct if the whole trailing slash or not part does not need to be in there, because matching something 1:1 must be a lot easier and less error-prone than also checking about trailing slashes or not.</p>
<p dir="auto"><strong>Description</strong></p>
<blockquote>
<p dir="auto">The automatic 301 redirection from /foo/ to /foo was introduced in Symfony 4.1. In previous Symfony versions this results in a 404 response.</p>
</blockquote>
<p dir="auto">This is a "magic" behaviour which can be unwanted in certain cases. For example it can <a href="https://stackoverflow.com/questions/13556772/jquery-ajax-wont-make-https-requests" rel="nofollow">break AJAX calls via HTTPS</a>.</p>
<p dir="auto">There should be an option to disable this behaviour and enforcing strict URL matching on the route, without any magic redirects behind.</p>