Spring MVC Path matching ignoring double slash //
<p>In a Spring Boot application I have set up a filter with url mapping <code>/service1/*</code>. This was done using a <code>FilterRegistrationBean</code>.</p>

<p>There is also a controller mapped to the same pattern:</p>

<pre><code>   @RestController @RequestMapping(path = "/service1")
   class Service1 {
   ...
</code></pre>

<p><strong>The problem:</strong></p>

<p>Executing POST <code>http://localhost:8080/service1/hello</code> works as expected (i.e. the filter is involved in the request processing chain, and the service controller invoked). However, executing <code>http://localhost:8080//service1/hello</code> (note the double slash) will bypass the filter, but reach the controller anyway due to Spring MVC more lenient path matching algorithm.</p>

<p>I've read that the controller path matching algorithm can be customized (link: <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc-config-path-matching" rel="noreferrer">http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc-config-path-matching</a>), however I don't find an option for not ignoring double slashes.</p>

<p><em>Also important: this behaviour means that any Controller protected by a filter (not Spring security, but any custom filter) can be bypassed just putting a double slash in any part of the URL. Is my understanding correct?
Do you know if the MVC controller path matching can be tweaked so that double slashes will not be ignored in the path matching algorithm?</em></p>