1

I am creating a microservice app with Spring cloud gateway and Consul. When I try getting a response from the microservice "example" with its port (3000) I get the response. But When I try to access with the gateway (demo) port (9090) I got the Whitelabel Error Page 404 error. Please help, thank you.

WhiteLabel 404 Error

Consul

application.yml

server:
  port: 9090
spring:
  cloud:
    gateway:
      routes:
        - id: example
          uri: lb://example
          predicates:
            - Path= /**
    loadbalancer:
      ribbon:
        enabled: true
    consul:
      host: 127.0.0.1
      port: 8500
      discovery:
        health-check-interval: 2s
        health-check-timeout: 2s
        tags: secure=true
        fail-fast: true
        instance-id: ${spring.application.name}:${random.value}
  jpa:
    database: mysql
    hibernate:
      ddl-auto: update
  datasource:
    url: jdbc:mysql://localhost:3306/gatewaypfe?serverTimezone=UTC
    username: root
    password:
  application:
    name: demo
  main:
    allow-bean-definition-overriding: true 
Karim zgoN
  • 11
  • 1
  • have you tried to access the same service both ways? – bichito Mar 24 '20 at 14:23
  • Yes I created another service X and I accessed to the example service through it and it worked. – Karim zgoN Mar 24 '20 at 16:43
  • 1
    Have you tried to intercept the error with an error handler and capture what is going on? – bichito Mar 24 '20 at 16:47
  • No. But All works for me when using Zuul – Karim zgoN Mar 25 '20 at 12:35
  • If I were you, I would add an error handler, launch a bugging session, put a breakpoint in the error handler, then use the gateway.Start with a controller error handler. If the error is happening elsewhere you will find out quickly – bichito Mar 25 '20 at 13:13

0 Answers0