系统已启动并在弹性中运行。这里添加了.eextensions文件夹(位于文件夹根目录中(中的配置
nginx-proxy.config
option_settings:
aws:elasticbeanstalk:environment:proxy:
GzipCompression: 'true'
ProxyServer: nginx
gzip.config
files:
/etc/nginx/conf.d/gzip.conf:
content: |
gzip on;
gzip_types application/json application/xml text/html text/xml text/plain application/javascript text/css;
gzip_vary on;
也尝试了tomcat-settings.config,但结果是相同的
option_settings:
aws:elasticbeanstalk:environment:proxy:
GzipCompression: 'true'
ProxyServer: nginx
只得到这些响应头还
cache-control →no-cache, no-store, max-age=0, must-revalidate
content-type →application/json
date →Mon, 31 Jan 2022 08:31:22 GMT
expires →0
pragma →no-cache
server →nginx/1.20.0
strict-transport-security →max-age=31536000 ; includeSubDomains
vary →Origin, Access-Control-Request-Method, Access-Control-Request-Headers
x-content-type-options →nosniff
x-frame-options →DENY
x-xss-protection →1; mode=block
应用程序属性文件
server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css
尝试为邮递员添加此标头太
'accept-encoding: gzip'
应用此后的工作
@Bean
public Filter compressingFilter() {
CompressingFilter compressingFilter = new CompressingFilter();
return compressingFilter;
}
依赖项使用了这个
<dependency>
<groupId>net.sourceforge.pjl-comp-filter</groupId>
<artifactId>pjl-comp-filter</artifactId>
<version>1.6.4</version>
</dependency>
发挥魅力:-(