神刀安全网

Nginx no longer retries non-idempotent upstream requests by default

Timestamp:
03/28/16 16:50:19 (15 hours ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
default
Message:

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".

Location:
src/http
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/http/modules/ngx_http_fastcgi_module.c

    r6303 r6467
    207 207 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
    208 208 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
    209 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
    209 210 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
    210 211 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
  • src/http/modules/ngx_http_proxy_module.c

    r6311 r6467
    214 214 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
    215 215 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
    216 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
    216 217 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
    217 218 { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 },
  • src/http/modules/ngx_http_scgi_module.c

    r6303 r6467
    78 78 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
    79 79 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
    80 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
    80 81 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
    81 82 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
  • src/http/modules/ngx_http_uwsgi_module.c

    r6303 r6467
    110 110 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
    111 111 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
    112 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
    112 113 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
    113 114 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
  • src/http/ngx_http_upstream.c

    r6466 r6467
    3990 3990 timeout = u->conf->next_upstream_timeout;
    3991 3991
    3992 if (u->request_sent
    3993 && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH)))
    3994 {
    3995 ft_type |= NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT;
    3996 }
    3997
    3992 3998 if (u->peer.tries == 0
    3993 || !(u->conf->next_upstream & ft_type)
    3999 || ((u->conf->next_upstream & ft_type) != ft_type)
    3994 4000 || (u->request_sent && r->request_body_no_buffering)
    3995 4001 || (timeout && ngx_current_msec – u->peer.start_time >= timeout))
  • src/http/ngx_http_upstream.h

    r6458 r6467
    30 30 #define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK       0x00000800
    31 31 #define NGX_HTTP_UPSTREAM_FT_MAX_WAITING     0x00001000
    32 #define NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT  0x00002000
    32 33 #define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
    33 34 #define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000

Note:SeeTracChangeset for help on using the changeset viewer.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Nginx no longer retries non-idempotent upstream requests by default

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮