[晕] nginx的internal属性的bug
Posted by bianbian on 2007-10-16 14:17
文档上说,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:
- error_page 404 /404.html;
- location /404.html {
- internal;
- }
实际发现,rewrite的用internal修饰后就挂了。像下面这个配置,如果/realpath/设了internal,用/proxypath/访问就是404。
这个跟本意是违背的(本意只能通过/proxypath/访问,而隐藏/realpath/),应该是nginx的bug(我的版本0.5.32)
- location /proxypath/ {
- root /realpathroot;
- rewrite ^/proxypath/(.+)$ /realpath/$1? last;
- }
- location /realpath/ {
- internal;
- }
遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道