Disable gzip inside an IF statement?

cx nginx-forum at nginx.us
Fri Jun 26 23:44:52 MSD 2009


I need to conditionally enable gzip, based on a variable.

When I try to use an "if" statement, it doesn't work, nginx complains I can't use "gzip" inside of "if".

Looking at the manual, I see gzip has the following context allowed:

"context: http, server, location, if (x) location"

What does "if (x) location" mean? I couldn't find an example.

Alternatively, if someone can suggest a way to disable gzip dynamically from within PHP, that would be great. It's possible to do this in Apache: 

<?php apache_setenv("no-gzip","1"); ?>

But obviously that function isn't supported in nginx.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3455,3455#msg-3455






More information about the nginx mailing list