【发布时间】:2020-11-30 15:15:13
【问题描述】:
在我们的 java springboot 应用程序中,我们需要压缩 REST 响应,因为 JSON 结构很大。在浏览网页时发现我们可以使用 application.properties 中的以下属性来启用压缩。
# Enable response compression
server.compression.enabled=true
# Minimum response where compression will kick in
server.compression.min-response-size=4096
# Mime types that should be compressed
server.compression.mime-types=text/html, text/xml, text/plain, text/css, text/javascript, application/javascript, application/json
它工作得很好,但它压缩了从该服务器返回的所有响应。
有没有办法过滤掉这种压缩。例如,我们只想压缩 URI 以 compress 或 merge
结尾的响应或者如果有任何其他建议可以达到同样的效果。
谢谢
【问题讨论】:
标签: java spring-boot rest microservices gzip