I managed to solve it. The key was to use content negotiation and not rewrite rules.
Here is the uber optimized Mendix Apache config file, it has the following features:
This results in a typical reduction from about 1,400 KB to around 308 KB!!
Here is the file. (Please let me know if you have a better/shorter way of doing this.) The only known issue is that /file requests do not seem to get the file. I will look into this...
When using the nginx web server, you can do:
gzip on; # will gzip json responses (from /xas/) on the fly gzip_proxied any; gzip_types application/json; # Boo! gzip_disable "msie6"; # will automagically present the .gz files gzip_static on;