【问题标题】:Gateway-service. 500 Server Error for HTTP GET "/"网关服务。 HTTP GET "/" 的 500 服务器错误
【发布时间】:2022-02-03 16:02:21
【问题描述】:

我在 Spring Boot 中遇到了一些与网关服务相关的问题。我有以下 .yml

  #spring.profiles.active: local
server:
  port: 80
  #ssl:
  #  enabled: true # Uses self-signed certificate because no key-store configuration is specified.

internal.lb.uri: http://34.125.111.144
spring:
  cloud:
    gateway:
      routes:
        - id: customers
          uri: ${internal.lb.uri}:9001
          predicates:
            - Path=/api/customers**
          filters:
            - RewritePath=/(?<path>.*), /$\{path}
        - id: employees
          uri: ${internal.lb.uri}:9000
          predicates:
            - Path=/api/employees**
          filters:
            - RewritePath=/(?<path>.*), /$\{path}
        - id: suppliers
          uri: ${internal.lb.uri}:9002
          predicates:
            - Path=/api/suppliers**
          filters:
            - RewritePath=/(?<path>.*), /$\{path}
        - id: webapp
          uri: ${internal.lb.uri}:9003
          predicates:
            - Path=/**
          filters:
            - RewritePath=/(?<path>.*), /$\{path}

当我运行它时,它运行完美!但是,一旦我尝试连接到 localhost,它会显示以下内容:

enter image description here

所以我不知道发生了什么!我找不到任何解决方案! 提前致谢!

【问题讨论】:

    标签: spring spring-boot microservices spring-cloud-gateway


    【解决方案1】:

    你需要改变你的 -> internal.lb.uri:http://34.125.111.144

    并将其替换为 -> internal.lb.uri: http://localhost

    然后重新启动所有微服务。

    这对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-01
      • 2012-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多