We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当后端系统(比如tomcat服务器)繁忙时,nginx会报502错误,如果原请求是post请求,出现502错误后,假设再次重定向到后端(比如tomcat)的的50x.html(这种场景不常见,只是假设),就会把不该发送的post数据发送过去
下面我们以http proxy为例说明原因: 当nginx internel direct到50x.html的时候,会调用ngx_http_proxy_create_request,会执行如下代码(中间我加了log)
1209 if (plcf->body_set == NULL && plcf->upstream.pass_request_body) { 1210 1211 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 1212 "pass req body:%V", &r->uri); 1213 1214 body = u->request_bufs; 1215 u->request_bufs = cl; 1216 1217 while (body) { 1218 b = ngx_alloc_buf(r->pool); 1219 if (b == NULL) { 1220 return NGX_ERROR; 1221 } 1222 1223 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t)); 1224 1225 cl->next = ngx_alloc_chain_link(r->pool); 1226 if (cl->next == NULL) { 1227 return NGX_ERROR; 1228 } 1229 1230 cl = cl->next; 1231 cl->buf = b; 1232 1233 body = body->next; 1234 if (ngx_strcmp(r->uri.data, "/50x.html") == 0) { 1235 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 1236 "body has content, heihei:%V", &r->uri); 1237 1238 }
这种问题对于其它代理模块均有问题。
对于ajp模块,这样设置,则会导致nginx直接崩溃
error_page 502 503 504 =200 /50x.html; location /{ ajp_pass tomcats; }
The text was updated successfully, but these errors were encountered:
王斌兄能帮忙修复这个问题吗?谢谢。
Sorry, something went wrong.
我使用的方式太土,还指望你们采用好的方式来参考一下呢
No branches or pull requests
当后端系统(比如tomcat服务器)繁忙时,nginx会报502错误,如果原请求是post请求,出现502错误后,假设再次重定向到后端(比如tomcat)的的50x.html(这种场景不常见,只是假设),就会把不该发送的post数据发送过去
下面我们以http proxy为例说明原因:
当nginx internel direct到50x.html的时候,会调用ngx_http_proxy_create_request,会执行如下代码(中间我加了log)
1209 if (plcf->body_set == NULL && plcf->upstream.pass_request_body) {
1210
1211 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1212 "pass req body:%V", &r->uri);
1213
1214 body = u->request_bufs;
1215 u->request_bufs = cl;
1216
1217 while (body) {
1218 b = ngx_alloc_buf(r->pool);
1219 if (b == NULL) {
1220 return NGX_ERROR;
1221 }
1222
1223 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
1224
1225 cl->next = ngx_alloc_chain_link(r->pool);
1226 if (cl->next == NULL) {
1227 return NGX_ERROR;
1228 }
1229
1230 cl = cl->next;
1231 cl->buf = b;
1232
1233 body = body->next;
1234 if (ngx_strcmp(r->uri.data, "/50x.html") == 0) {
1235 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1236 "body has content, heihei:%V", &r->uri);
1237
1238 }
这种问题对于其它代理模块均有问题。
对于ajp模块,这样设置,则会导致nginx直接崩溃
error_page 502 503 504 =200 /50x.html;
location /{
ajp_pass tomcats;
}
The text was updated successfully, but these errors were encountered: