Welcome! Log In Create A New Profile

Advanced

Re: try_files wildcards

Maxim Dounin
February 08, 2013 05:14AM
Hello!

On Fri, Feb 08, 2013 at 01:56:59PM +0400, ivan babrou wrote:

> Hello!
>
> I have use-case where i need to check file presence in different
> directories.
>
> For example, I have static file test.css with versions in different
> revisions:
>
> /v1/static/test.css
> /v1/static/test_v001.css (same as test.css in this dir)
> /v2/static/test.css
> /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.css
> /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)

Which test.css you expect to be returned for /static/test.css?

> 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?

I don't think so.

> Are there better and easier ways to solve my problem?

An obvious solution would be to keep links on a file system.

--
Maxim Dounin
http://nginx.com/support.html

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

try_files wildcards

ivan babrou 890 February 08, 2013 04:58AM

Re: try_files wildcards

Maxim Dounin 524 February 08, 2013 05:14AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready