I cannot create a proper deployment package for AWS Elastic Beanstalk to enable gzip compression on Windows IIS environments.
I enabled in web config as described here. This worked only for static files, dynamic files are served as is.
Anybody have a solution for this?
Edit: There is another issue with IIS. It doesn't compress files requested from proxies and also serves the original file on the first request. This causes CDN's to serve uncompressed file because their endpoints caches the original file.
After struggling 10 hours finally I came up with a solid solution.
AWS supports config files to modify the environment. They run before deploying application. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
So I created a config file to enable gzip on IIS, placed it to ".ebextensions/gzip.config" in my project folder.
Configuration in YAML format:
There are some changes needed in web.config to system.webServer section:
With this two changes Elastic Beanstalk instances are prepared to serve compressed static and dynamic files. Also works with CDN.
If your applicationHost.config disables changes in web.config:
I found it easiest to supplement the existing applicationHost.config dynamicTypes using '05''s below.