Welcome! Log In Create A New Profile

Advanced

gzip_static uses gzip_types ?

Posted by newcomer11 
gzip_static uses gzip_types ?
May 03, 2011 09:59AM
Hi, currently nginx 1.0 gzip_static(HttpGzipStaticModule) doesn't use the gzip_types applied for gzip (HttpGzipModule). So when I try to precompresse js and css file, it also try the image file (trace by strace in this post : http://stackoverflow.com/questions/3972675/how-to-tell-gzip-static-not-to-look-for-image-files)
Re: gzip_static uses gzip_types ?
May 05, 2011 12:21AM
I found a way to edit the source code of nginx but in a very awful way :

1. find file :

ngx_http_gzip_static_module.c (ver 1.0.1, other version may be the same):

2 .in:

ngx_http_gzip_static_handler(ngx_http_request_t *r)

3 .found :

if (r->uri.data[r->uri.len - 1] == '/') {
return NGX_DECLINED;
}

4 .add :

if ( r->uri.data[r->uri.len - 1] == 'g' && r->uri.data[r->uri.len - 2] == 'n' && r->uri.data[r->uri.len - 3] == 'p' && r->uri.data[r->uri.len - 4] == '.') {
return NGX_DECLINED;
}
if ( r->uri.data[r->uri.len - 1] == 'g' && r->uri.data[r->uri.len - 2] == 'p' && r->uri.data[r->uri.len - 3] == 'j' && r->uri.data[r->uri.len - 4] == '.') {
return NGX_DECLINED;
}
if ( r->uri.data[r->uri.len - 1] == 'o' && r->uri.data[r->uri.len - 2] == 'c' && r->uri.data[r->uri.len - 3] == 'i' && r->uri.data[r->uri.len - 4] == '.') {
return NGX_DECLINED;
}

5. Recompile your source.

Anyone know C can edit it to be more professtinal because I don't know C :(



Edited 2 time(s). Last edit at 05/05/2011 12:27AM by newcomer11.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 150
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready