Search code examples
springdocker-composespring-cloudgateway

Spring Cloud Gateway not routing (404 for any request)


I've been trying to create a docker-compose stack with Spring Cloud Gateway, Eureka, a config service and some micro services. Those services start and work on their own, exposed ports, the config service works and Eureka registers those services. But I can't get Spring Cloud Gateway to work.

The service starts correctly (or at least there are no errors in the log) and when I remote into the container I'm able to request the service I want to call, but If I try the request it via the configured route I'm receiving an 404.

My gateway config (I combined the config service config and the bootstrap.yml for convenience):

spring:
  application:
    name: gateway-service
  cloud:
    config:
      uri: http://config-service:8080 
eureka:
  client:
    serviceUrl:
      defaultZone: http://discovery-service:8061/eureka/
logging:
  pattern:
    console: "%d{yyyy-MM-dd HH:mm:ss} ${LOG_LEVEL_PATTERN:-%5p} %m%n"
spring:
  cloud:
    gateway:
      routes:
      - id: employee-service
        predicates:
        - "Path=/employee/**"
        filters:
        - StripPrefix=1
        uri: "http://employee-service:8080"

I'm pretty sure I just misunderstood some trivial thing and I'm just a click away from success, but ... I just can't find it.

What I expect to happen:

My containers:

0.0.0.0:8080->8080/tcp, 8088/tcp                           employee-app_gateway-service_1
8088/tcp, 0.0.0.0:5082->5005/tcp, 0.0.0.0:8082->8080/tcp   employee-app_employee-service_1
8088/tcp, 0.0.0.0:8011->8061/tcp                           employee-app_discovery-service_1
8088/tcp, 0.0.0.0:8012->8080/tcp                           employee-app_config-service_1

Solution

  • This has to be one of my most shameful layer 8 issues. boostrap.yml != bootstrap.yml. I did spend three days on this. I'm not sure if I'm angry on myself or ashamed. I hope you'll have a laugh on me :-)