I have Nginx reverse proxying my service that works by OData protocol. I'm trying to enable compression for theese requests by putting
#...
gzip on;
gzip_types application/json;
#...
server {
#...
location /odata/ {
proxy_pass http://localhost:7700/odata/;
}
#...
}
in nginx.conf.
Sometimes my service returns
Content-Type: application/json; charset=utf-8; odata.metadata=minimal
and Nginx compresses it.
But sometimes my service returns
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
and Nginx doesn't compress such responses.
What should I do to enable Nginx compressing such responses?
Solved this problem by writing middleware in my application, that changes Content-Type header and transforms it to application/json; charset=utf-8; odata.metadata=minimal; odata.streaming=true;
After that Nginx could recognize it as json content type and compresses it.