Re: Сжимать gzip контент отданный модулем

Fly3110 nginx-forum на nginx.us
Ср Мар 16 22:28:49 MSK 2011


Так как всех запутал (не нарочно: ) ) решил собрать все в одном посте.

Кусок конфига:
location ~ ^\/ng\/size([0-9]*)\/.*(?:\.exe|).*$ {rewrite \/size([0-9]*)\/.*(?:\.exe|).*$ /ng.exe?size=$1 last;    }
location = /ng.exe {
        my_flv;
        gzip on;
        root /var/www/softs;
        gzip_http_version 1.1;
        gzip_min_length   10;
        gzip_types        text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-msdownload;
        gzip_vary         on;
        gzip_proxied      any;
        gzip_disable      "MSIE [1-6]\.";
        gzip_comp_level   9;
        gzip_static off;
    }


Кусок модуля:
    r->headers_out.status = NGX_HTTP_OK;
    r->headers_out.content_length_n = size;
    r->headers_out.last_modified_time = of.mtime;
    r->headers_out.content_type.data = "application/x-msdownload";
    r->headers_out.content_type.len = 24;

Wireshark:

GET /ng/size28746752/test.exe HTTP/1.1
Host: 93.189.59.146
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive

HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Wed, 16 Mar 2011 16:11:31 GMT
Content-Type: application/x-msdownload
Content-Length: 28746752
Last-Modified: Wed, 05 Jan 2011 02:45:46 GMT
Connection: keep-alive
Accept-Ranges: bytes

MZP..................... at .......jr......................................!..L.!..This program must be run under Win32


нужны какие-то еще данные?

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,183152,183321#msg-183321




Подробная информация о списке рассылки nginx-ru