Welcome! Log In Create A New Profile


Modest Feature Requests - mime types & try_files

Posted by holstebm 
Modest Feature Requests - mime types & try_files
July 28, 2009 01:21AM

I have two relatively modest feature requests that I think would be useful. The first is the ability to use wildcards in the gzip types declarations. That is 'test/*' or 'application/*'. Since mime types and gzip types are established at server start, this change would minimally impact server performance.

The second is the ability for try_files to use locations in all positions and the elimination of the two argument restriction. I admit my motives are selfish but, in all honesty, I don't see how these restrictions add to these directives. Let me be clear with an example:

try_files @here @there @everywhere;

I don't believe this works and, if not, if that is by design or a bug since I don't see anything in the documentation that prohibits it (plus nginx does not complain about the syntax here, either). I do know that I have tried two locations for nocache and cache and the following will not work:

try_files @nocache @cache;

@cache is always reached even if @nocache should succeed. I have found a workaround but it would be cleaner if this just worked.

Second, why not allow a single entry (which would also solve the above non-working example in my case):

try_files @cache;

That way if the entry succeeds on the @cache location, it will skip the current block but will process the current block if it fails. No need to include other arguments. At the same time, does not preclude using additional arguments.

Both of these would make nginx more flexible without sacrificing any other functionality.

Right now to get around these I have to do something like this

location ~ \.php$ {
try_files @noop @nocache; # @noop is not a valid location

#cache logic follows....


What I would like to do is something like:

location ~ \.php$ {

try_files @nocache @memcache @cache;


Or, at the very least:

location ~ \.php$ {

try_files @nocache;

#cache logic here

Re: Modest Feature Requests - mime types & try_files
July 16, 2010 12:36AM
... Holy crap that looks disguising. You should look at what you're really trying to do because whatever you're trying is very ugly.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready