Mercurial > hg > nginx-quic
diff src/http/ngx_http_upstream.c @ 6467:91c8d990fb45
Upstream: proxy_next_upstream non_idempotent.
By default, requests with non-idempotent methods (POST, LOCK, PATCH)
are no longer retried in case of errors if a request was already sent
to a backend. Previous behaviour can be restored by using
"proxy_next_upstream ... non_idempotent".
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 28 Mar 2016 19:50:19 +0300 |
parents | 984687f25998 |
children | 2cd019520210 |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -3989,8 +3989,14 @@ ngx_http_upstream_next(ngx_http_request_ timeout = u->conf->next_upstream_timeout; + if (u->request_sent + && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH))) + { + ft_type |= NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT; + } + if (u->peer.tries == 0 - || !(u->conf->next_upstream & ft_type) + || ((u->conf->next_upstream & ft_type) != ft_type) || (u->request_sent && r->request_body_no_buffering) || (timeout && ngx_current_msec - u->peer.start_time >= timeout)) {