005_nginx414_nginx 414 Request-URI Too Large

时间:2022-10-06 05:05:20

一、开发请求一个非常长的请求参数

https://jiaju.jyall.me/backend/dish/getSales/?dishId=167271&dishId=166975&dishId=166509&dishId=167088&dishId=166976&dishId=159375&dishId=167099&dishId=167100&dishId=166972&dishId=166984&dishId=167102&dishId=166983&dishId=154888&dishId=166829&dishId=166726&dishId=161672&dishId=166732&dishId=166009&dishId=166551&dishId=163661&dishId=167289&dishId=163187&dishId=166716&dishId=166769&dishId=167306&dishId=166767&dishId=166010&dishId=166008&dishId=166007&dishId=167417&dishId=167409&dishId=167355&dishId=148870&dishId=166730&dishId=165985&dishId=166781&dishId=156045&dishId=159153&dishId=167407&dishId=166012&dishId=163724&dishId=167402&dishId=166836&dishId=166834&dishId=167353&dishId=166426&dishId=166778&dishId=156784&dishId=167336&dishId=167337&dishId=166428&dishId=166661&dishId=166728&dishId=158731&dishId=166542&dishId=166475&dishId=166631&dishId=167332&dishId=166541&dishId=166257&dishId=166634&dishId=156032&dishId=166953&dishId=166632&dishId=166547&dishId=162482&dishId=166545&dishId=166733&dishId=166724&dishId=154890&dishId=154463&dishId=166549&dishId=166653&dishId=166651&dishId=163252&dishId=166783&dishId=166543&dishId=166558&dishId=166550&dishId=166548&dishId=166540&dishId=166647&dishId=166544&dishId=166621&dishId=166940&dishId=166546&dishId=166620&dishId=166576&dishId=166530&dishId=166531&dishId=161561&dishId=100543&dishId=155895&dishId=159897&dishId=158368&dishId=162827&dishId=157485&dishId=160262&dishId=158289&dishId=158297&dishId=155972&dishId=162826&dishId=166525&dishId=163608&dishId=163774&dishId=166810&dishId=166800&dishId=156214&dishId=165984&dishId=166256&dishId=166809&dishId=164279&dishId=144576&dishId=166886&dishId=163438&dishId=162823&dishId=166802&dishId=166296&dishId=159887&dishId=166771&dishId=166811&dishId=158730&dishId=163685&dishId=163097&dishId=164937&dishId=165573&dishId=166812&dishId=100711&dishId=166266&dishId=147612&dishId=166885&dishId=138097&dishId=165742&dishId=166770&dishId=101492&dishId=166269&dishId=155679&dishId=166429&dishId=156838&dishId=163197&dishId=165983&dishId=155880&dishId=159869&dishId=165987&dishId=165214&dishId=135801&dishId=166110&dishId=100427&dishId=166577&dishId=165982&dishId=162821&dishId=166258&dishId=163194&dishId=141532&dishId=166823&dishId=166255&dishId=166335&dishId=165641&dishId=165844&dishId=157486&dishId=102608&dishId=165986&dishId=164004&dishId=2802&dishId=166259&dishId=156387&dishId=166292&dishId=159624&dishId=166278&dishId=155587&dishId=165731&dishId=166354&dishId=166348&dishId=166013&dishId=166135&dishId=166014&dishId=165998&dishId=165981&dishId=163768&dishId=165999&dishId=166279&dishId=166353&dishId=166405&dishId=166018&dishId=156434&dishId=165740&dishId=158287&dishId=163725&dishId=115358&dishId=155583&dishId=163651&dishId=162416&dishId=162775&dishId=156364&dishId=155673&dishId=155670&dishId=156661&dishId=158332&dishId=158733&dishId=163475&dishId=163656&dishId=142641&dishId=163743&dishId=158345&dishId=164920&dishId=159353&dishId=156660&dishId=164762&dishId=165115&dishId=155728&dishId=155694&dishId=163103&dishId=162319&dishId=158645&dishId=162704&dishId=153627&dishId=165216&dishId=166271&dishId=162520&dishId=159874&dishId=165574&dishId=165744&dishId=165566&dishId=100861&dishId=155468&dishId=162550&dishId=165571&dishId=163963&dishId=157335&dishId=144874&dishId=162779&dishId=165738&dishId=156955&dishId=159118&dishId=155695&dishId=156782&dishId=161608&dishId=158735&dishId=165753&dishId=163729&dishId=164039&dishId=152438&dishId=159468&dishId=165567&dishId=164018&dishId=107526&dishId=134981&dishId=162639&dishId=141530&dishId=160175&dishId=101383&dishId=162522&dishId=165572&dishId=156418&dishId=159427&dishId=159856&dishId=155879&dishId=164432&dishId=162828&dishId=162382&dishId=162437&dishId=153451&dishId=163104&dishId=159419&dishId=165997&dishId=165843&dishId=155857&dishId=155883&dishId=162711&dishId=165734&dishId=165948&dishId=155887&dishId=156837&dishId=159864&dishId=163893&dishId=162845&dishId=158670&dishId=161855&dishId=157474&dishId=163539&dishId=159476&dishId=162843&dishId=100514&dishId=159865&dishId=165570&dishId=165479&dishId=155685&dishId=158672&dishId=165105&dishId=162824&dishId=150099&dishId=165481&dishId=163161&dishId=164958&dishId=165581&dishId=165794&dishId=165579&dishId=165565&dishId=160403&dishId=165580

location /backend {
if ( $query_string ~* "^.{2049,}$" ) {
return 414;
} client_max_body_size 0;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://xxxt_api_backend;
}

二、

测试后nginx返回

nginx 414 Request-URI Too Large