gzip client & proxy with sub_filter sanity check.

Steve Wilson lists-nginx at swsystem.co.uk
Thu Oct 18 19:18:01 UTC 2012


On 18/10/2012 20:00, Maxim Dounin wrote:
> 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.

Ah yeah, looking at it now I can see this as the content for sub_filter
is already gunzipped.

>> 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.
> 
> 

I should have perhaps mentioned that I use the nginx-extras package from
debian in production to get the configure line and just added in the
gunzip flag myself for testing.

Having read through some of the enabled options I'll probably end up
creating our own nginx build to remove some unwanted options.

Steve.



More information about the nginx mailing list