try_files is broken with geoip?

Francis Daly francis at
Mon Mar 30 19:18:52 UTC 2015

On Mon, Mar 30, 2015 at 08:26:13PM +0300, Peter Volkov wrote:

Hi there,

> We experience problem: if inside location we use geoip variable try_files
> is not working and only root location is looked up for files.

That is working as expected for "if" inside "location". It's unrelated
to geoip.

Third item:

        # try_files wont work due to if
        location /if-try-files {
             try_files  /file  @fallback;
             set $true 1;
             if ($true) {
                 # nothing

You'll want to redesign whatever you are doing not to use "if" inside
"location" for anything other than "return" or effective equivalents.

Francis Daly        francis at

More information about the nginx mailing list