title: Spring Cloud Gateway and DiscoveryClient Routes
body: <p>I am trying to migrate a gateway that's working using <code>spring-cloud-starter-netflix-zuul</code> to Spring Cloud Gateway, and I'm running into issues with request routing.</p>
  
  <p>I ran across the following documentation regarding configuring predicates and filters for DiscoveryClient routes:</p>
  
  <p><a href="https://cloud.spring.io/spring-cloud-gateway/single/spring-cloud-gateway.html#_configuring_predicates_and_filters_for_discoveryclient_routes" rel="noreferrer">Configuring Predicates and Filters For DiscoveryClient Routes</a></p>
  
  <p>Here's a snippet from my Netflix Zuul configuration:</p>
  
  <pre><code>zuul:
    routes:
      account-service: /accounts/**
  </code></pre>
  
  <p>And here is a snippet from the Spring Cloud Gateway configuration where I'm attempting to configure an equivalent route:</p>
  
  <pre><code>spring:
    cloud:
      gateway:
        routes:
          - id: account-service-route
            uri: lb://account-service
            predicates:
            - Path=/accounts/**
  </code></pre>
  
  <p>I am using Spring Cloud Eureka as my Discovery Server (in a separate microservice), and I do not currently have any configuration as outlined in <a href="https://cloud.spring.io/spring-cloud-gateway/single/spring-cloud-gateway.html#_configuring_predicates_and_filters_for_discoveryclient_routes" rel="noreferrer">Configuring Predicates and Filters For DiscoveryClient Routes</a></p>
  
  <p>If I issue a request to <code>/accounts/***</code>, I receive a 404 reponse. If I change the Spring Cloud Gateway configuration to the following and issue the same request to <code>/account-service/***</code>, I receive a 403 Forbidden response:</p>
  
  <pre><code>spring:
    cloud:
      gateway:
        routes:
          - id: account-service-route
            uri: lb://account-service
            predicates:
            - Path=/account-service/**
  </code></pre>
  
  <p>I am suspecting that this has something to do with the default behavior of Spring Cloud Gateway with respect to how DiscoveryClient Routes are configured, but I don't see enough in the logs to point me in the right direction.</p>
  
  <p>So, my question is this: When using Spring Cloud Gateway with Spring Cloud Eureka, is it required to make the configuration entries as outlined in <a href="https://cloud.spring.io/spring-cloud-gateway/single/spring-cloud-gateway.html#_configuring_predicates_and_filters_for_discoveryclient_routes" rel="noreferrer">Configuring Predicates and Filters For DiscoveryClient Routes</a>? </p>
  
  <p>If so, can someone provide more explanation/clarity around what needs to be configured referring back to my route examples? Sorry if I'm missing something, but it's not obvious to me from what I read what exactly is needed with this configuration. For example, are the <code>spring.cloud.gateway.discovery.locator.predicates</code> and <code>spring.cloud.gateway.discovery.locator.filters</code> configured in addition to or in place of the <code>spring.cloud.gateway.routes</code> predicates and filters? </p>
  
  <p>If not, what other configuration(s) might I be missing?</p>
  
  <p>I am on Spring Cloud Finchley.SR3/Spring Boot 2.0.8.RELEASE.</p>