try_files wildcards

ivan babrou ibobrik at
Fri Feb 8 09:56:59 UTC 2013


I have use-case where i need to check file presence in different

For example, I have static file test.css with versions in different

/v1/static/test_v001.css (same as test.css in this dir)
/v2/static/test_v002.css (same as test.css in this dir)

In this case I want to make all files accessible by urls:

/static/test_v001.css (test.css version 1)
/static/test_v002.css (test.css version 2)
/static/test_v000.css (test.css in the last version)

Obvious solution that I see:

location / {
  root /var/www/
  try_files /*/$uri /v2/$uri =404;

This way I specify latest version as v2, but here comes the problem:
try_files does not support wildcards.

It is adequate to have support for wildcards (*) in try_files? Will you
accept patch? Are there better and easier ways to solve my problem?

Regards, Ian Babrou skype:i.babrou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list