gzip client & proxy with sub_filter sanity check.

Maxim Dounin mdounin at mdounin.ru
Thu Oct 18 19:00:35 UTC 2012


Hello!

On Thu, Oct 18, 2012 at 07:49:36PM +0100, Steve Wilson wrote:

> After some playing with debian's current version of nginx I've reached
> the conclusion it's not possible without the gunzip module.
> 
> Below is my current test configuration, in short I'm trying to reduce
> the server bandwidth by having proxy upstream requests and client
> responses gzipped, however I need to rewrite some content in-line.
> 
> Is this the best way to go about this or am I over complicating it?
> 
> server {
>         listen   80;
>         listen   [::]:80 default_server ipv6only=on;
>         server_name localhost;
>         gzip on;
>         location / {
>                 proxy_pass http://127.0.0.1:8000;
>                 proxy_set_header Accept-Encoding "";
>         }
> }
> 
> server {
>         listen 127.0.0.1:8000;
>         server_name site1;
>         location / {
>                 proxy_pass http://127.0.0.1:8001;
>                 sub_filter foo bar;
>                 sub_filter_once off;
>                 proxy_set_header Accept-Encoding "";
>         }
> }

These two server{} blocks may be safely joined together.

> server {
>         listen 127.0.0.1:8001;
>         server_name site2;
>         gunzip on;
>         location / {
>                 proxy_pass http://www.example.org;
>                 proxy_set_header Accept-Encoding gzip;
>         }
> }

And probably we want to implement something like

    gunzip always;

to allow such processing in a single server block.

[...]
 
> --with-sha1=/usr/include/openssl \
> --with-md5=/usr/include/openssl \

Just a side note: this is incorrect.  As per ./configure help:

  --with-md5=DIR                     set path to md5 library sources
  --with-sha1=DIR                    set path to sha1 library sources

Obviously you don't have any sources to build in 
/usr/include/openssl.  Just remove these configure arguments.


-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx mailing list