I am running one older app in company, due to internal policy and app needs it must run on Windows7. App is consist from Flask 0.12.4, WSGI server is Cherrypy 17.4.1. I successfully run this app but I would like to switch on GZIP compression, but I am not able to do that. I went through several documentation and code examples but nothing work. App is only for intranet so I can't test it using some online tools.
my cherrypy configuration:
import os
import cherrypy
from machines import app
path = os.path.abspath(os.path.dirname(__file__))
config = {
'global' : {
'server.socket_host' : '0.0.0.0',
'server.socket_port' : 5000,
'server.thread_pool' : 10,
'log.screen':True,
'log.error_file': './log/cherry_error.log',
'environment': 'production',
},
'/static' : {
'tools.gzip.on' : True,
'tools.staticdir.on' : True,
'tools.staticdir.dir' : os.path.join(path, 'static'),
'tools.gzip.mime_types': ['text/*', 'application/*'],
}
}
if __name__ == '__main__':
cherrypy.tree.graft(app.wsgi_app, '/')
cherrypy.config.update(config)
cherrypy.engine.start()
I have tested served files using firefox and chrome developers tools, but it claim no GZIP compression.
Using curl is seems to be same:
curl --head --compressed http://192.168.1.4:5000/static/style.css
HTTP/1.1 200 OK
Content-Length: 68506
Content-Type: text/css; charset=utf-8
Last-Modified: Sat, 07 Sep 2019 14:55:52 GMT
Cache-Control: public, max-age=43200
Expires: Sun, 08 Sep 2019 04:54:20 GMT
ETag: "1567868152.63-68506-1294405540"
Date: Sat, 07 Sep 2019 16:54:20 GMT
Accept-Ranges: bytes
Server: 0.0.0.0
True is I can live without that, but I am really curious what is wrong here. If somebody can advice me I would be really grateful.