请求行太大 - 枪支
我已经使用了烧瓶一年多了,我使用Gunicorn WSGI服务器将部署烧瓶应用程序用于生产。最近,我遇到了一个奇怪的错误,
<html>
<head>
<title>Bad Request</title>
</head>
<body>
<h1><p>Bad Request</p></h1>
Request Line is too large (4269 > 4094)
</body>
</html>
我在大多数get
请求中遇到了此错误。
在调试时,我知道,我需要增加- gunicorn中的limit-request-line
config在我将其增加到8190
我的dockerfile < /code>,我能够成功地看到烧瓶应用程序的响应。
我所做的码头文件是
CMD gunicorn app:app -w 2 --threads 50 -b 0.0.0.0:8080 --limit-request-line 8190 --capture-output --log-level info
我在这里的问题, 为什么HTTP请求行大小/长度
突然增加,因为我没有在过去40天内重新启动烧瓶应用程序,因此Gunicorn
版本没有更改。服务器完美地返回响应39天,然后突然给了我这个错误。
有什么想法吗?
edit1: 我发现问题是由于多个滤波器值而形成的大get请求。
I have been using Flask for over a year, I used deploy my Flask app into production using Gunicorn WSGI server. Recently I encountered a weird error that,
<html>
<head>
<title>Bad Request</title>
</head>
<body>
<h1><p>Bad Request</p></h1>
Request Line is too large (4269 > 4094)
</body>
</html>
I encountered this error for most of my GET
requests.
While debugging I came to know that, I need to increase the --limit-request-line
config in Gunicorn after I increased that to 8190
in my Dockerfile
, I was able to see the responses from the Flask app successfully.
The dockerfile change I made was
CMD gunicorn app:app -w 2 --threads 50 -b 0.0.0.0:8080 --limit-request-line 8190 --capture-output --log-level info
My question here is,
Why did the http request line size/length
increase suddenly, because I haven't redeployed my Flask app in past 40 days, so the Gunicorn
version wasn't changed. The server was returning responses perfectly for 39 days, then suddenly it gave me this error.
Any idea on this?
Edit1:
I found that the issue was due to the large get request being formed due to multiple filter values.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SET
- limit-request-line
to 0。这将允许无限的请求长度。但是,在代码中添加请求尺寸验证以避免任何安全风险。Set
--limit-request-line
to 0. This will allow unlimited request length. However, add a request size validation inside code to avoid any security risks.