file-upload - Docker Rocket chat Rest api上传文件报错413 Entity too large

标签 file-upload rocket.chat

我正在使用 rocket chat rest API,一切正常,但是当我将文件上传到 rocket chat rest api 时,它显示错误 413 Request Entity Too Large,但是当我从网站上传文件时它上传了任何大小的文件。

检查所有场景后,我得出结论,文件大小小于等于 1 MB 上传成功,大于 1 MB 显示此错误 413 Request Entity Too Large

我使用这个 url 从 postman 上传文件 https://rocket.chat.url/api/v1/rooms.upload/RoomId

标题:

Content-Type:application/x-www-form-urlencoded

X-Auth-Token:User-Token

X-User-Id:User-Id

表单数据:

file - selected file

HTML 结果错误

<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

文件插入成功后显示如下

{
   "success": true
}

最佳答案

在检查了许多场景并搜索了许多 url 之后,我从 this 获得了解决方案.

我用过rocket chat docker我将一行添加到 nginx配置文件。

解决方案:

  1. 登录到ubuntu服务器
  2. 写入 sudo nano/etc/nginx/nginx.conf 并回车
  3. 中添加或更新client_max_body_size
http {

    client_max_body_size 8M; #used your exceeded limit instead of 8M

    #other lines...

}
  1. 重启nginx通过命令 service nginx restartsystemctl restart nginx
  2. 再次上传大文件,成功。

关于file-upload - Docker Rocket chat Rest api上传文件报错413 Entity too large,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59064268/

相关文章:

php - PHP 中的 move_uploaded_file 不起作用?

javascript - 如何在前端上传临时图 block 并在其浏览器 html div 元素上查看

python - Flask如何获取上传文件的状态

database - 验证文件完整性?

ubuntu-16.04 - 错误 : snap "rocketchat-server" not found

node.js - Rocket Chat - 文件上传堆栈为 0%

rocket.chat - Rocket Chat - 通过 Rest API 登录

php - 从iPhone将大型视频上传到Web服务器

electron - 我是否要重建 Electron 包以使用 Rocket Chat 获得定制的前端?

mongodb - 无法在 Docker 上使用 Rocketchat 连接到本地主机