【问题标题】:Spring Cloud Gateway - Compress all the responsesSpring Cloud Gateway - 压缩所有响应
【发布时间】:2021-05-24 11:39:12
【问题描述】:

我正在使用 Spring Cloud Gateway,版本 2.2.7.RELEASE,作为微服务应用程序的网关。我们使用 Spring Boot 开发了每个微服务。来自微服务的响应没有被压缩。

我正在搜索如何直接在网关中执行响应压缩,可能是GlobalFilter。但是,我在 Internet 上没有找到任何参考资料。

有可能吗?

【问题讨论】:

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


    【解决方案1】:

    这比我想象的要容易。 在 application.yml 文件中启用属性server.compression.enabled 就足够了。如果您想获得所有可用选项的列表,请查看official documentation

    警告:代理微服务也不必压缩响应。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-09
      • 2020-07-19
      • 1970-01-01
      • 2012-05-18
      • 1970-01-01
      • 2019-06-29
      • 2018-05-10
      • 1970-01-01
      相关资源
      最近更新 更多