Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does nginx support compress the request to the upstream?

Tags:

nginx

Dose nginx supprt this ? Whoul you please show me some configuration of it?

[Client]           [Nginx Reverse Proxy]               [BackEnd]
   |   [Raw Post]         |    [gzip encoded request]     |   
   |--------------------> | ----------------------------->|
   |                      |                               |  
   |   [Raw Response]     |    [gzip encoded response]    |
   | <------------------  | <-----------------------------|
   |                      |                               |
like image 287
Freeman Zhang Avatar asked May 30 '13 12:05

Freeman Zhang


People also ask

Does nginx compress by default?

By default, NGINX does not compress responses to proxied requests (requests that come from the proxy server). The fact that a request comes from a proxy server is determined by the presence of the Via header field in the request. To configure compression of these responses, use the gzip_proxied directive.

What is the use of upstream in nginx?

With NGINX Plus, configuration of upstream servers in a server group can be modified on-the-fly without reloading the servers and NGINX configuration. This is useful for: autoscaling, when you need to add more servers.

What are the capabilities of nginx?

NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability.

Does nginx support sticky session?

NGINX Plus supports three session persistence methods. The methods are set with the sticky directive.


1 Answers

Apparently there is some way to do this. Nginx has a gunzip module that gzip decompresses responses:

The ngx_http_gunzip_module module is a filter that decompresses responses with “Content-Encoding: gzip” for clients that do not support “gzip” encoding method. The module will be useful when it is desirable to store data compressed, to save space and reduce I/O costs.

This module is not built by default, it should be enabled with the --with-http_gunzip_module configuration parameter.

Source: http://nginx.org/en/docs/http/ngx_http_gunzip_module.html

Then you can use it like:

gunzip on;

Hope that works for you.

Also see this SO question: Is there sort of unzip modules in nginx?

like image 99
gitaarik Avatar answered Sep 17 '22 22:09

gitaarik