March 05, 2014 07:44AM
Всем привет!

Столкнулся с неожиданной проблемой. Если включен proxy_cache и используется ssi, curl часто выдает ошибку

* Received problem 3 in the chunky parser
* Closing connection #0
curl: (56) Received problem 3 in the chunky parser

и в error.log:

2014/03/05 16:33:55 [info] 31373#0: *525 client prematurely closed connection while sending to client, client: 1.1.1.1, server: host.ru, request: "GET / HTTP/1.1", subrequest: "/includes/lists/tabloid", upstream: "http://127.0.0.1:9030/includes/lists/tabloid", host: "host.ru"

Все начинает правильно работать, при следующих условиях:

1. ssi off и тогда nginx начинает передавать curl заголовок Content-Lenght
2. proxy_cache не используется и ssi on

Конфиг:

ssi on;

gzip_static on;

keepalive_requests 20;
location ~ ^/includes {

include /etc/nginx/conf/access.conf;

proxy_cache some-cache;
proxy_cache_valid 200 302 301 304 10s;
proxy_cache_key "$request_method|$host|$uri";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503;
proxy_cache_lock on;

proxy_http_version 1.1;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Accept text/html;
proxy_set_header Host host.ru;

proxy_pass http://localhost:9030;


}

location / {

proxy_cache some-cache;
proxy_cache_valid 200 302 301 304 30s;
proxy_cache_key "$request_method|$host|$uri";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503;
proxy_cache_lock on;

proxy_http_version 1.1;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Accept text/html;
proxy_set_header Host host.ru;

proxy_pass http://localhost:9030;
}

Заголовки приложения:

< HTTP/1.1 200 OK
< Date: Wed, 05 Mar 2014 12:38:37 GMT
< Status: 200 OK
< Connection: close
< Content-Type: text/html; charset=utf-8
< Content-Length: 20041
< X-UA-Compatible: IE=Edge,chrome=1
< ETag: "8bdee631c5839fef72100f192025570b"
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: bd50bffa8386d8c870448d47f2f00941
< X-Runtime: 0.116565

Заголовки которые отдает nginx:

< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 05 Mar 2014 12:38:11 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Status: 200 OK
< X-UA-Compatible: IE=Edge,chrome=1
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: 5238e092ddcf2a4b83e527fda2892145
< X-Runtime: 0.098263
Subject Author Posted

Проблема с curl, proxy_cache и Content-Lenght

ddr400 March 05, 2014 07:44AM

Re: Проблема с curl, proxy cache и Content-Lenght

Maxim Dounin March 05, 2014 08:56AM

Re: Проблема с curl, proxy cache и Content-Lenght

ddr400 March 06, 2014 01:42AM

Re: Проблема с curl, proxy cache и Content-Lenght

Maxim Dounin March 06, 2014 05:08AM

Re: Проблема с curl, proxy cache и Content-Lenght

ddr400 March 06, 2014 05:39AM

Re: Проблема с curl, proxy cache и Content-Lenght

Maxim Dounin March 06, 2014 09:06AM

Re: Проблема с curl, proxy cache и Content-Lenght

Maxim Dounin March 06, 2014 09:38AM

Re: Проблема с curl, proxy cache и Content-Lenght

ddr400 March 06, 2014 11:44AM

Re: Проблема с curl, proxy cache и Content-Lenght

Maxim Dounin March 06, 2014 12:08PM

Re: Проблема с curl, proxy cache и Content-Lenght

Artem Suvorov July 08, 2016 09:42AM

Re: Проблема с curl, proxy cache и Content-Lenght

Валентин Бартенев July 08, 2016 09:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready