I have a nginx server acting as load balancer, which delegates requests to other application servers.
When I try to request a asset directly to the application server, the asset is served in it's gzipped version, sample:
➜ ~ curl -IH 'Accept-Encoding: gzip, deflate' http://application/asset.css
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Thu, 15 Sep 2016 14:13:03 GMT
Content-Type: text/css
Content-Length: 35038
Connection: keep-alive
Content-Encoding: gzip
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Cache-Control: public
While the same request to the load balancer, returns the non-compressed version of the asset.
➜ ~ curl -IH 'Accept-Encoding: gzip, deflate' https://load-balancer/asset.css
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Thu, 15 Sep 2016 14:16:15 GMT
Content-Type: text/css
Content-Length: 240442
Connection: keep-alive
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Cache-Control: public
Accept-Ranges: bytes
Here my configuration for the LB:
location / {
client_max_body_size 10M;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https; # if use ssl
proxy_redirect off;
proxy_pass http://application;
}
thanks in advance