Description
Symfony versions affected: 3.4, 4.2, master
Given the following route definition:
api:
path: /
schemes: ['https']
methods: ['POST']
# ...
this GET http://127.0.0.1:8000/
will return the Symfony welcome page (404) instead of the automatic redirection to https
(301) and finally the expected "Method not allowed" (405) exception.
Currently, there is a test case that exactly covers the previous scenario and a pure ResourceNotFoundException
is expected due to the https
scheme mismatch:
symfony/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
Lines 493 to 503 in 287da8d
now it's working because NoConfigurationException
extends from ResourceNotFoundException
.
How to reproduce
Just changes ResourceNotFoundException
by NoConfigurationException
in the test case and look how it pass.
Possible Solution
Still working on it... hints are welcome.
By now, I'm trying to collect $this->allowSchemes
as was done in 4.2 and update this line:
symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
Lines 79 to 81 in 287da8d
We might need a separate bugfix PR for 4.2+