Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
error_page and Content-Length: 0
Здравствуйте! Помогите пожалуйста разобраться с проблемой.
FreeBSD 7.2-STABLE amd62, nginx/0.7.64
-------------------------------------------
$ telnet 127.0.0.1 5190
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a HTTP/1.0
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 14 Dec 2009 10:32:34 GMT
Content-Type: image/png
Connection: close
-------------------------------------------
$ telnet 127.0.0.1 5190
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /b HTTP/1.0
HTTP/1.1 404 Not Found
Server: nginx
Date: Mon, 14 Dec 2009 10:38:20 GMT
Content-Type: image/png
Connection: close
-------------------------------------------
$ telnet 127.0.0.1 5190
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /c HTTP/1.0
HTTP/1.1 404 Not Found
Server: nginx
Date: Mon, 14 Dec 2009 10:40:10 GMT
Content-Type: image/png
Content-Length: 0
Connection: close
-------------------------------------------
Непонятно откуда берется заголовок "Content-Length: 0" - в PHP скрипте
его нет да и если добавить fastcgi_hide_header Content-Length то он
остается.
Во всех трех случаях отдается нормальная PNGшка, но в последнем
браузер ее не отображает из-за "Content-Length: 0" видимо.
Логика работы последнего (/c) location:
1. пытаемся считать из mogilefs несуществующей файл
2. на 404 переходим в @boxMogilefs
3. PHP скрипт возвращает 404
4. на 404 переходим в @boxUniversal404
5. PHP возвращает PNGшку
Конфиг:
server {
listen 127.0.0.1:5190
default;
access_log off;
proxy_intercept_errors on;
fastcgi_intercept_errors on;
recursive_error_pages on;
error_page 404
/img/imagenotfound.png;
location /img/ {
root /home/cropbox/www/linkme;
}
location = /a {
set $box_source
/home/app_cropbox/img/imagenotfound.png;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
/home/app_cropbox/cropbox/boxUniversal.php;
fastcgi_param QUERY_STRING
source=$box_source&newMaxWidth=100&newMaxHeight=100&cutHeight=0;
fastcgi_pass cropbox;
}
location = /b {
error_page 404 @boxUniversal404;
set $box_filename
donotexist.png;
set $box_newMaxWidth 100;
set $box_newMaxHeight 100;
set $box_cutHeight 0;
return 404;
}
location = /c {
set $box_filename dontexist.png;
set $box_newMaxWidth 100;
set $box_newMaxHeight 100;
set $box_cutHeight 0;
error_page 404 = @boxMogilefs;
mogilefs_domain <domain>;
mogilefs_methods GET;
mogilefs_tracker <ip>:<port>;
mogilefs_pass $box_filename {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
}
location @boxUniversal404 {
set $box_source
/home/app_cropbox/img/imagenotfound.png;
error_page 404 /img/imagenotfound.png;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
/home/app_cropbox/cropbox/boxUniversal.php;
fastcgi_param QUERY_STRING
source=$box_source&newMaxWidth=$box_newMaxWidth&newMaxHeight=$box_newMaxHeight&cutHeight=$box_cutHeight;
fastcgi_pass cropbox;
}
location @boxMogilefs {
error_page 404 @boxUniversal404;
include fastcgi_params;
# fastcgi_hide_header Content-Length;
fastcgi_param SCRIPT_FILENAME
/home/app_cropbox/cropbox/boxMogilefs.php;
fastcgi_param QUERY_STRING
filename=$box_filename&newMaxWidth=$box_newMaxWidth&newMaxHeight=$box_newMaxHeight&cutHeight=$box_cutHeight;
fastcgi_pass cropbox;
}
}
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|