Gzip if in location example

Syntax: gzip on | off;
Default: gzip off;
Context: http, server, location, if in location

Is there an example of this “if in location” usage ?

Posted at Nginx Forum:

This I suppose:

    location / {
        try_files $uri $uri/ =404;
        if ($scheme = http) { gzip on; }
        index  index.html index.htm;
    }

Posted at Nginx Forum: