openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.32k stars 2.04k forks source link

toggle gzip of response #258

Closed rkearsley closed 11 years ago

rkearsley commented 11 years ago

Hi

My current solution to this is to duplicate locations :( and add 'gzip on;' to them and then ngx.exec accordingly

It would be nicer if I could do something like 'ngx.var.gzip = "on"'

Is there another way?

Many thanks

mtourne commented 11 years ago

On Tue, Jul 9, 2013 at 9:13 AM, Richard Kearsley notifications@github.comwrote:

Hi

My current solution to this is to duplicate locations :( and add 'gzip on;' to them and then ngx.exec accordingly

It would be nicer if I could do something like 'ngx.var.gzip = "on"'

I think the cheapest way to do something like that would be to modify the internal Nginx gzip module just a tiny bit to accept a variable input (evaluated at each request), instead of using a fixed toggle per location.

Hope this helps, Matthieu.

agentzh commented 11 years ago

Yes, it's indeed the ngx_gzip module's duty to be more flexible here. There's not really anything that can be done on the ngx_lua side.

rkearsley commented 11 years ago

roger that thanks