[晕] nginx的internal属性的bug

文档上说,internal用来禁止用户直接通过地址访问。
syntax: internal
default: no
context: location

internal indicates that the matching location can be used only for so called “internal” requests.
For external requests it will return the error “Not found” (404).
Internal requests are the following:
1) requests redirected by the instruction error_page
2) subrequests created by the command include virtual of the “ngx_http_ssi_module” module
3) requests changed by the instruction rewrite of the “ngx_http_rewrite_module” module

An example to prevent clients fetching error pages directly:

实际发现,rewrite的用internal修饰后就挂了。像下面这个配置,如果/realpath/设了internal,用/proxypath/访问就是404。
这个跟本意是违背的(本意只能通过/proxypath/访问,而隐藏/realpath/),应该是nginx的bug(我的版本0.5.32)

发表评论