升级0.65版本后,上传文件会出现失败。
Self Checks
- [X] This is only for bug report, if you would like to ask a quesion, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] Pleas do not modify this template :) and fill in all the required fields.
Dify version
0.65
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
自部署的docker版本,升级0.65版本后,超过1m文件上传会出现上传文件失败,之前5.9版本都是正常的。本机用了nginx反代端口,文件配置上也已经加上client_max_body_size的设置了。
页面报413错误。
本机nginx的配置
✔️ Expected Behavior
希望能够上传超过1m文件
❌ Actual Behavior
No response
To address the issue of failing file uploads larger than 1MB in Dify version 0.65, despite having client_max_body_size set to 300M in Nginx, you'll need to adjust Dify's internal file upload size limits. These settings are found within Dify's configuration, specifically in the api/config.py file, and include UPLOAD_FILE_SIZE_LIMIT and UPLOAD_IMAGE_FILE_SIZE_LIMIT. By default, these may not match the limit you've set in Nginx.
Here's how to resolve the issue:
-
Modify Dify Configuration: Open the
api/config.pyfile in your Dify installation and change theUPLOAD_FILE_SIZE_LIMITandUPLOAD_IMAGE_FILE_SIZE_LIMITvalues to300(or your desired limit in megabytes). -
Restart Dify Application: To apply the configuration changes, restart your Dify application. If using Docker, this can be done with:
docker-compose down docker-compose up -d -
Ensure Nginx Configuration Matches: Double-check that your Nginx configuration's
client_max_body_sizeis set to300Mor your desired limit. -
Test the File Upload: Attempt to upload a file larger than 1MB again to confirm the issue is resolved.
Adjusting both the Nginx and Dify configurations to support larger file uploads should solve the problem. However, be aware of potential risks associated with increasing the file upload size limit, such as increased resource consumption and security risks.
Details
Sources
- 知识库上传文件报错
- en/getting-started/install-self-hosted/docker-compose.md
- docker/nginx/nginx.conf
- api/config.py
- api/.env.example
- en/features/datasets/maintain-dataset-via-api.md
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Close due to #1542
已经按照给出的办法设置了,还是上传失败。
@koulas 解决了吗?我也遇到同样问题