Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#231 closed defect (invalid)

ngx_http_internal_redirect bypasses explicit location block

Reported by: kriation Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.2.x
Keywords: Cc:
uname -a: Linux zita 3.5.6-1-ARCH #1 SMP PREEMPT Sun Oct 7 19:30:49 CEST 2012 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.2.4
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=http --group=http --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/client-body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-imap --with-imap_ssl_module --with-ipv6 --with-pcre-jit --with-file-aio --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --add-module=/usr/lib/passenger/ext/nginx

Description

With the config below, if the server hits any of the error pages, /favicon.ico is still logged in the access_log. I additionally tested a case where access_log was set to logs/favico.log in the location block, and favico.log was never written to.

Is http_internal_redirect intentionally designed to bypass processing of the location blocks?

http {

include mime.types;
root /srv/http;

error_page 500 502 503 504 /error/50x.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;

server {

listen 80 default_server;
server_name _;
root /srv/http/default;


server_name_in_redirect off;
access_log logs/default.access.log combined;


location = /favicon.ico {

access_log off;
log_not_found off;

}


}

}

Change History (2)

comment:1 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

Requests are logged in the context of a location where request processing ends. That is, as soon as request processing ends in location = /favicon.ico, request will not be logged. But if there is no favicon.ico file, and request to /favicon.ico is redirected due to 404 error - it will be logged in a context of a location where 404 error page is processed.

in reply to:  1 comment:2 by kriation, 12 years ago

Replying to Maxim Dounin:

(...) it will be logged in a context of a location where 404 error page is processed.

Understood! Thank you.

Note: See TracTickets for help on using tickets.