简体   繁体   English

Nginx:413请求实体太大错误

[英]Nginx: 413 Request Entity Too Large Error

Okay guys, I have followed these answers 413 Request Entity Too Large 好的,我已经遵循以下答案413请求实体过大

add client_max_body_size 20M in nginx.conf and also inside httpd.confd folder which is related with my proxy configuration. 在nginx.conf中以及与我的代理配置相关的httpd.confd文件夹中添加client_max_body_size 20M I added in http, server and location block. 我在http,服务器和位置块中添加了内容。 I use Play! 我使用Play! Framework as my gateway. 框架是我的网关。

But still, I'd have Request entity too large error . 但是,仍然有Request entity too large error Do you guys have any idea or suggestions? 你们有什么想法或建议吗? Or link to follow through? 或链接以进行跟踪?

Thanks 谢谢

As well as the web servers in front of Play, which it sounds like you have configured, Play itself has max request Content-Length limits, documented here: https://www.playframework.com/documentation/2.5.x/JavaBodyParsers#Content-length-limits 听起来好像已经配置好了Play前面的Web服务器,Play本身也具有最大请求内容长度限制,记录在这里: https : //www.playframework.com/documentation/2.5.x/JavaBodyParsers#内容长度的限制

Most of the built in body parsers buffer the body in memory, and some buffer it on disk. 大多数内置的主体解析器会将主体缓存在内存中,有些则将其缓存在磁盘上。 If the buffering was unbounded, this would open up a potential vulnerability to malicious or careless use of the application. 如果缓冲是无限的,则可能会导致恶意或粗心使用该应用程序的潜在漏洞。 For this reason, Play has two configured buffer limits, one for in memory buffering, and one for disk buffering. 因此,Play具有两个已配置的缓冲区限制,一个用于内存缓冲,一个用于磁盘缓冲。

The memory buffer limit is configured using play.http.parser.maxMemoryBuffer , and defaults to 100KB, while the disk buffer limit is configured using play.http.parser.maxDiskBuffer , and defaults to 10MB. 内存缓冲区限制是使用play.http.parser.maxMemoryBuffer配置的,默认值为100KB,而磁盘缓冲区限制是使用play.http.parser.maxDiskBuffer配置的,默认值为10MB。 These can both be configured in application.conf, for example, to increase the memory buffer limit to 256KB: 这些都可以在application.conf中进行配置,例如,将内存缓冲区限制增加到256KB:

Depending on the situation, you may want to be careful with increasing this limit too much -- if you have untrusted clients they may be able to overload your server by sending lots of very large requests in a short space of time. 根据情况,您可能需要谨慎提高此限制,如果您拥有不受信任的客户端,他们可能会在短时间内发送大量非常大的请求,从而使服务器超载。 This may cause your server to crash with an OutOfMemoryError , leading to a denial of service attack. 这可能会导致您的服务器因OutOfMemoryError崩溃而导致拒绝服务攻击。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM