【问题标题】:Spring Cloud Gateway listen to both HTTP and HTTPS?Spring Cloud Gateway 同时监听 HTTP 和 HTTPS?
【发布时间】:2019-08-03 13:00:36
【问题描述】:

如何配置 Spring Cloud Gateway 服务器以同时接受 HTTP 和 HTTPS 连接?

我已将 SSL 配置到网关服务器上的端口 443。我还想接受端口 80 上的 HTTP 请求。我知道如何使用运行 Tomcat 的标准 Spring Boot 应用程序来执行此操作,但我需要知道如何配置 Gateway 使用的 Netty 服务器。

【问题讨论】:

    标签: spring spring-cloud-gateway


    【解决方案1】:

    Spring CLoud Gateway 文档展示了解决方案: 7. TLS / SSL

    网关路由可以路由到 http 和 https 后端。如果路由到 https 后端,则可以将网关配置为使用以下配置信任所有下游证书:

    application.yml.

    spring:
      cloud:
        gateway:
          httpclient:
            ssl:
              useInsecureTrustManager: true
    

    【讨论】:

      【解决方案2】:

      显然spring cloud gateway使用了不直接支持的webflux,但是有一些方法: How to configure in Spring Boot 2 (w/ WebFlux) two ports for HTTP and HTTPS?

      也在等待真正的解决方案: https://github.com/spring-projects/spring-boot/issues/12035

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-12-11
        • 2014-08-04
        • 1970-01-01
        • 2021-10-20
        • 2013-04-12
        • 2019-06-24
        • 2021-12-28
        相关资源
        最近更新 更多