Opened 3 weeks ago

Closed 3 weeks ago

#2081 closed enhancement (wontfix)

The restriction on directive "alias" is not complete.

Reported by: zhoushulin1992@… Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.18.x
Keywords: Cc: zhoushulin1992@…
uname -a: Linux xlarge 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.18.0
built by gcc 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configure arguments: --prefix=/usr/local/nginx --with-pcre=/root/Downloads/pcre-8.43

Description

Directive "alias" cannot used inside the named location, but none of the document about "alias" or "location" is mentioned about this.
Also, when a location rewrite the URI, the directive "alias" should not be used.

I suggest that we should add this information in the description of directive "alias" in https://nginx.org/en/docs/http/ngx_http_core_module.html#alias.

Change History (1)

comment:1 by Maxim Dounin, 3 weeks ago

Resolution: wontfix
Status: newclosed

Thank you for your suggestion.

Semantically, the "alias" directive specifies the replacement for the URI part matched by the location. For obvious reasons it does not make sense in named locations.

The same applies to URI rewrites without re-selecting location: as long as location no longer matches the rewritten URI, the "alias" directive does not make sense.

Documenting these restrictions explicitly hardly make sense, as these are merely implications of the "alias" directive semantics.

Note: See TracTickets for help on using tickets.