通过领事和Spring Cloud Gateway进行服务路由404

时间:2020-03-24 13:07:24

标签: spring-boot http-status-code-404 microservices spring-cloud-gateway spring-cloud-consul

我正在使用Spring云网关和Consul创建一个微服务应用程序。 当我尝试从微服务“示例”及其端口(3000)获得响应时,我得到了响应。 但是,当我尝试使用网关(演示)端口(9090)访问时,出现了Whitelabel Error Page 404错误。 请帮忙,谢谢。

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 

0 个答案:

没有答案