title: Spring Cloud Gateway : disable default routes
body: <p>I'm using spring cloud to manage my microservices.</p>
  
  <p>For security reasons, for one specific microservice (name it ms_secure), I want to use custom route choose a specific microservice version depending on client IP.</p>
  
  <p>My gateway config looks like this:</p>
  
  <pre><code>spring:
    cloud:
      gateway:
        discovery:
          locator:
            enabled: true
        routes:
          - id: ms_secure_v1
            uri: lb://ms_secure_v1
            predicates:
              - Path=/ms_secure/**
            filters:
              - RewritePath=/ms_secure/(?&lt;segment&gt;.*), /$\{segment}
              - name: &lt;my filter&gt;
                args:
                  xForwardedForHeaderName: X-Forwarded-For
                  hosts:
                    - &lt;IP1&gt;
                    - &lt;IP2&gt;
  
          - id: ms_secure
            uri: lb://ms_secure_v2
            predicates:
              - Path=/ms_secure/**
            filters:
              - RewritePath=/ms_secure/(?&lt;segment&gt;.*), /$\{segment}
              - name: &lt;my filter&gt;
                args:
                  xForwardedForHeaderName: X-Forwarded-For
                  hosts:
                    - &lt;IP3&gt;
                    - &lt;IP4&gt;
  </code></pre>
  
  <p>When when requesting /ms_secure:</p>
  
  <ul>
  <li>IP1 and IP2 will be redirected to ms_secure_v1</li>
  <li>IP3 and IP4 will be redirected to ms_secure_v2</li>
  </ul>
  
  <p>My problem is that all my clients will also be able to access directly ms_secure_v1 or ms_secure_v2 by using the default routes:</p>
  
  <blockquote>
    <p>http:///ms_secure_v1/...</p>
    
    <p>http:///ms_secure_v2/...</p>
  </blockquote>
  
  <p>I tried to disable these routes by using SetStatus GatewayFilter:</p>
  
  <pre><code>        - id: setstatusstring_route
            uri: lb://ms-gateway
            predicates:
              - Path=/ms_secure_v**
            filters:
            - SetStatus=403
  </code></pre>
  
  <p>But this route is not matched.</p>
  
  <p>Is there a way to disable these default routes in spring gateway?</p>