Welcome! Log In Create A New Profile

Advanced

Re: Игнорируется client max body size в именованном location

Валентин Бартенев
July 18, 2013 10:18AM
On Tuesday 16 July 2013 17:26:53 yanda.a wrote:
> Доброго времени суток!
> Недавно столкнулись с проблемой настройки nginx. Суть в том, что при
> попадании в именованный location не срабатывает параметр
> client_max_body_size определенный в нем. Например, при следующей
> конфигурации и попытке залить файл размером более 1 МБ по адресу
> http://server/index.php мы сталкиваемся с ограничением на максимальный
> размер файла (получаем 413), при этом, в именованном location явно указан
> параметр, переопределяющий это стандартное значение.
>
> location / {
> root /var/www/htdocs/;
> try_files $uri @proxy_upstream;
> }
>
> location @proxy_upstream {
> proxy_pass http://127.0.0.1:80;
>
> proxy_redirect off;
> proxy_intercept_errors on;
>
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forwarded-Port $server_port;
>
> client_max_body_size 10m;
> client_body_buffer_size 128k;
> }
>
> Но, если перенести параметр client_max_body_size в location /, куда
> изначально попадает запрос, то данный параметр работает нормально и файл
> залить удается.
>
> Параметры сборки nginx:
> #nginx -V
> nginx version: nginx/1.4.1
> TLS SNI support enabled
> configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
> /usr/local/include' --with-ld-opt='-L /usr/local/lib'
> --conf-path=/usr/local/etc/nginx/nginx.conf
> --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
> --error-log-path=/var/log/nginx-error.log --user=www --group=www
> --with-debug --with-file-aio
> --http-client-body-temp-path=/var/tmp/nginx/client_body_temp
> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp
> --http-proxy-temp-path=/var/tmp/nginx/proxy_temp
> --http-scgi-temp-path=/var/tmp/nginx/scgi_temp
> --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp
> --http-log-path=/var/log/nginx-access.log --with-http_addition_module
> --with-http_geoip_module --with-http_gzip_static_module
> --with-http_image_filter_module --with-http_realip_module
> --with-http_secure_link_module --with-http_stub_status_module --with-pcre
> --with-http_ssl_module
>
>
> Собственно вопрос, в чем может быть причина игнорирования
> client_max_body_size в именованном location?
>

Причина в том, что ограничение в "location /, куда изначально попадает запрос"
срабатывает раньше. Ограничение проверяется при каждом выборе location.

--
Валентин Бартенев
http://nginx.org/en/donation.html
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Re: Игнорируется client max body size в именованном location

Валентин Бартенев July 18, 2013 10:18AM

Re: Игнорируется client max body size в именованном location

yanda.a July 24, 2013 02:11AM

Re: Игнорируется client max body size в именованном location

Maxim Dounin July 24, 2013 03:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready