如何在Spring Boot 2.0应用程序中指定压缩级别?
文档中指定的选项仅允许您启用/禁用压缩,指定mime类型和指定最小响应大小。
是否要对所有响应进行最大级别(即级别9)的压缩?
答案 0 :(得分:0)
尝试: spring.http.gzip.deflate-compression-level =#用于压缩压缩的级别(0-9)。附录:
# HTTP response compression (GzipFilterProperties)
spring.http.gzip.buffer-size= # size of the output buffer in bytes
spring.http.gzip.deflate-compression-level= # the level used for deflate compression (0-9)
spring.http.gzip.deflate-no-wrap= # noWrap setting for deflate compression (true or false)
spring.http.gzip.enabled=true # enable gzip filter support
spring.http.gzip.excluded-agents= # comma-separated list of user agents to exclude from compression
spring.http.gzip.exclude-agent-patterns= # comma-separated list of regular expression patterns to control user agents excluded from compression
spring.http.gzip.exclude-paths= # comma-separated list of paths to exclude from compression
spring.http.gzip.exclude-path-patterns= # comma-separated list of regular expression patterns to control the paths that are excluded from compression
spring.http.gzip.methods= # comma-separated list of HTTP methods for which compression is enabled
spring.http.gzip.mime-types= # comma-separated list of MIME types which should be compressed
spring.http.gzip.excluded-mime-types= # comma-separated list of MIME types to exclude from compression
spring.http.gzip.min-gzip-size= # minimum content length required for compression to occur
spring.http.gzip.vary= # Vary header to be sent on responses that may be compressed