It is possible to get Google App Engine to gunzip while downloading. Here are the steps:
- First, enable GZip on your App Engine app by adding a particular line to the app.yaml file. The file should contain the following:
runtime: python27
api_version: 1
threadsafe: true
handlers:
url: /.*
script: main.app
secure: always
url: /static
static_dir: static
secure: always
url: /admin
script: main_admin.app
login: admin
Enables firing of GZip response when requested by the browser
url: /.*
static_files: static/index.html
upload: static/index.html
http_headers:
Set the charset for non-html responses
- Content-Type: application/octet-stream
Enable GZip response
- Content-Encoding: gzip
Next, you will want to add additional settings in the app.yaml file. Go to "appengine_config.py" and add the following code:
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
# Automatically add recording middleware
app = recording.appstats_wsgi_middleware(app)
# Compress responses
from google.appengine.ext.appstats import gzip_middleware
# Automatically add gzip and encoding middleware
app = gzip_middleware.gzipper(app,
compress_level=5,
minimum_size_bytes=500)
return app
- Finally, you will need to generate a custom version of the "App Engine SDK for Python" for your app. To do this, you can use tools like gunicorn. You can refer to this page for more information on deploying Gunicorn with App Engine and setting up the gunzip: https://cloud.google.com/appengine/docs/standard/python/using-gunicorn.
Once you have configured Gunicorn and the gunzip feature, your App Engine app should download the files using GZip.