# Please helpe me, hacking the module Gzip Pre-Compression Module

**URL:** <https://www.ruby-forum.com/t/please-helpe-me-hacking-the-module-gzip-pre-compression-module/225117>\
**Category:** NGINX\
**Created:** [December 14, 2012, 6:29pm UTC](https://www.ruby-forum.com/t/please-helpe-me-hacking-the-module-gzip-pre-compression-module/225117 "2012-12-14T18:29:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 14, 2012, 6:29pm UTC](https://www.ruby-forum.com/t/please-helpe-me-hacking-the-module-gzip-pre-compression-module/225117/1 "2012-12-14T18:29:34Z")

</div>

Hello,  
I wrote to Igor but do not have the response so I write my question here  
and  
please help me.

Firse of all, excuse me for my bad english!!!

I hack the module “ngx\_http\_gzip\_static\_module.c” and I know that if  
client  
demande a file A, for example, the server NGINX will search the file  
“A.gz”  
and if it exist, Server will uncompress this gz file and the Server will  
serve the file uncompress of A.gz.

It is not my objectif. My objectif is if a client demande a file B, for  
example. The server will search the file B.gz(compressed file) and serve  
this file if it exists. Client will receive file B.gz, not file B  
uncompressed.

I lost for weeks for hacking this function but do not success. Please  
help  
me to figure out how I can realize this.

Thanks for your help.

VVPHAM

Posted at Nginx Forum:

> **[Please helpe me, hacking the module Gzip Pre-Compression Module](https://forum.nginx.org/read.php?2,234044,234044#msg-234044)**
>
> Hello, I wrote to Igor but do not have the response so I write my question here and please help me. Firse of all, excuse me for my bad english!!!!! I hack the module "ngx\_http\_gzip\_static\_module.c" and I know that if client demande a file...

---

<div class="post-metadata">

**Author:** ![vvpham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e47774/32.png) [@vvpham](https://www.ruby-forum.com/u/vvpham)\
**Post date:** [December 14, 2012, 6:57pm UTC](https://www.ruby-forum.com/t/please-helpe-me-hacking-the-module-gzip-pre-compression-module/225117/2 "2012-12-14T18:57:37Z")

</div>

Hello!

On Fri, Dec 14, 2012 at 12:29:15PM -0500, vvpham wrote:

> Hello,  
> I wrote to Igor but do not have the response so I write my question here and  
> please help me.
> 
> Firse of all, excuse me for my bad english!!!
> 
> I hack the module “ngx\_http\_gzip\_static\_module.c” and I know that if client  
> demande a file A, for example, the server NGINX will search the file “A.gz”  
> and if it exist, Server will uncompress this gz file and the Server will  
> serve the file uncompress of A.gz.

This is incorrect. The gzip\_static assumes there are two files  
with identical contents:

foo  
foo.gz

The “foo” file (uncompressed one) will be returned to clients  
which doesn’t support gzip. The “foo.gz” file (compressed one)  
will be returned to clients which support gzip.

If you want nginx to uncompress a gz file, you have to use  
recently introduced gunzip module, see [Module ngx\_http\_gunzip\_module](http://nginx.org/r/gunzip),  
along with gzip\_static set to “always”.

> It is not my objectif. My objectif is if a client demande a file B, for  
> example. The server will search the file B.gz(compressed file) and serve  
> this file if it exists. Client will receive file B.gz, not file B  
> uncompressed.
> 
> I lost for weeks for hacking this function but do not success. Please help  
> me to figure out how I can realize this.

I’m not sure I understand correctly what you want, but it looks  
like what you are asking for is “gzip\_static always”, as available  
in nginx 1.3.6+. See [Module ngx\_http\_gzip\_static\_module](http://nginx.org/r/gzip_static) for details.

–  
Maxim D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.
