Directly redirecting prefix location to named one

I am considering the following locations:

location / {
proxy_pass http://upstream;
}

location /documents/ {
try_files $uri @upstream;
}

location @upstream {
proxy_pass http://upstream;
}

I would like to have a single named location to handle all fallbacks to
upstream (to avoid duplication: maintenance will be easier!).

How does one redirect a prefix location directly to a named one?
Using try_files might expose documents which are not supposed to be
served
outside of the /documents/ tree.

Using rewrite? I learned here to avoid it as much as possible…

B. R.

I use this model in some parts of my configs. I, however, use openresty
and
I’m not clear if there are any functionality differences between them.

Hello!

On Thu, May 15, 2014 at 5:52 PM, Lord N. wrote:

HTTP Echo Module | NGINX

I use this model in some parts of my configs. I, however, use openresty and
I’m not clear if there are any functionality differences between them.

No difference here. OpenResty bundles this ngx_echo module directly.

Regards,
-agentzh