-
Notifications
You must be signed in to change notification settings - Fork 176
李昌文 edited this page Nov 10, 2018
·
4 revisions
- 方法一:在 one-main 的 application.yml 中添加配置压缩Http请求
server:
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript
- 方法二:在Nginx中启用Gzip
http {
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf application/font-woff2 font/opentype image/svg+xml image/x-icon;
......
}
- 打包到one-main中运行之后,HttpCacheFilter会对js\css\图片等静态资源添加缓存头部,让浏览器缓存这些静态资源。
- 也可以在Nginx中启用缓存