Opened 2 years ago

Last modified 4 weeks ago

#97 accepted defect

try_files and alias problems

Reported by: Maxim Dounin Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc:
Sensitive: no
uname -a: na
nginx -V: na

Description (last modified by Maxim Dounin)

# bug: request to "/test/x" will try "/tmp/x" (good) and
# "/tmp//test/y" (bad?)
location /test/ {
    alias /tmp/;
    try_files $uri /test/y =404;
}
# bug: request to "/test/x" will fallback to "fallback" instead of "/test/fallback"
location /test/ {
    alias /tmp/;
    try_files $uri /test/fallback?$args;
}
# bug: request to "/test/x" will try "/tmp/x/test/x" instead of "/tmp/x"
location ~ /test/(.*) {
    alias /tmp/$1;
    try_files $uri =403;
}

Or document special case for regexp locations with alias? See 3711bb1336c3.

# bug: request "/foo/test.gif" will try "/tmp//foo/test.gif"
location /foo/ {
    alias /tmp/;
    location ~ gif {
        try_files $uri =405;
    }
}

Change History (9)

comment:1 Changed 2 years ago by Maxim Dounin

  • Description modified (diff)
  • Status changed from new to accepted

comment:2 Changed 2 years ago by Maxim Dounin

  • Description modified (diff)

comment:3 Changed 2 years ago by Maxim Dounin

  • Description modified (diff)

Added case from ticket #176.

comment:4 Changed 22 months ago by Maxim Dounin

See also ticket #217.

comment:5 Changed 11 months ago by Maxim Dounin

  • Description modified (diff)
  • Sensitive unset

comment:6 Changed 6 months ago by Tuğrul Topuz

Also not works with rewrite. I tried to make fallback with rewrite.

comment:7 Changed 3 months ago by Bernard Rosset

I still confirm Maxim's reported bug 1st example of bug as of today with 1.6.0.

alias core function is to do precisely that, and its combination with try_files is one of the simplest I can think of.

Could its severity be incremented?

comment:8 Changed 5 weeks ago by Algirdas Grum

This bug is really annoying, simple task to have few sites in different locations under one vhost becomes problem...

comment:9 Changed 4 weeks ago by Christopher Monsanto

Could someone please fix this bug? I run into it fairly often. At this point it's one of the very oldest open tickets on this tracker.

Note: See TracTickets for help on using tickets.