Welcome! Log In Create A New Profile

Advanced

proxy_pass takes Content-Length from another subrequest

Marat Dakota
May 01, 2013 08:24PM
Hi.

My module makes a few subrequests with body (I populate sr->request_body
and set Content-Length in sr-headers_in).

These subrequests are landing to a locations that look like:

location /backend {
internal;
rewrite /backend(.+) $1 break;
proxy_pass http://mybackend;
}

location /backend2 {
internal;
rewrite /backend2(.+) $1 break;
proxy_pass http://mybackend2;
}

The problem is that proxy_pass takes Content-Length from the first
subrequest and uses it for the second subrequest. So, when the first
subrequest is longer than the second one, the second one never ends, and
when the first one is shorter, the second backend (mybackend2) receives
incomplete body.

I've spent quite a time tracing the problem and for the moment I've figured
out that Content-Length comes from these lines in ngx_http_proxy_module.c:

while (*(uintptr_t *) e.ip) {
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
}

I haven't managed to go deeper at the moment.

So, question is — am I doing something wrong or is it a bug?

Thanks.

--
Marat
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

proxy_pass takes Content-Length from another subrequest

Marat Dakota 910 May 01, 2013 08:24PM

Re: proxy_pass takes Content-Length from another subrequest

lanshun zhou 406 May 02, 2013 11:28PM

Re: proxy_pass takes Content-Length from another subrequest

Marat Dakota 489 May 03, 2013 05:30PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready