XBackBone
XBackBone copied to clipboard
"Request Entity Too Large" despite `post_max_size` and `upload_max_filesize` being set to a larger amount.
System Info
- PHP Version: 8.2.16
- XBackBone Version: v3.7.0
- Webserver: Nginx
- Database backend: SQLite
Describe the bug
I encounter the error Request Entity Too Large when uploading a 1.25 Mb file, when my upload size parameters are set to 200 Mb.
To Reproduce Steps to reproduce the behavior:
- Take a screenshot of a busy screen. Have the final png size be > 1 Mb.
- Attempt to upload to XBackBone.
Expected behavior The image should upload.
Image
Logs XBackBone
2024-03-16 20:31:50.977 - Task in queue. Job: FileUpload, Type: Image, Host: Custom image uploader
2024-03-16 20:31:51.069 - Task status: Working
2024-03-16 20:31:51.101 - Upload started. File name: librewolf_LAK5cATxMe.png, File path: C:\Users\accou\Documents\ShareX\Screenshots\2024-03\librewolf_LAK5cATxMe.png
2024-03-16 20:31:53.301 - Error:
Error message:
The remote server returned an error: (413) Request Entity Too Large.
Request URL:
https://xbb.soda64.com/upload
Status code:
(413) Request Entity Too Large
Headers:
Connection: keep-alive
Content-Length: 176
Content-Type: text/html
Date: Sat, 16 Mar 2024 17:31:52 GMT
Server: nginx
Response text:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at ShareX.UploadersLib.Uploader.SendRequestFile(String url, Stream data, String fileName, String fileFormName, Dictionary`2 args, NameValueCollection headers, CookieCollection cookies, HttpMethod method, String contentType, String relatedData)
2024-03-16 20:31:53.301 - Upload failed. Retrying upload.
2024-03-16 20:31:55.451 - Error:
Error message:
The remote server returned an error: (413) Request Entity Too Large.
Request URL:
https://xbb.soda64.com/upload
Status code:
(413) Request Entity Too Large
Headers:
Connection: keep-alive
Content-Length: 176
Content-Type: text/html
Date: Sat, 16 Mar 2024 17:31:54 GMT
Server: nginx
Response text:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at ShareX.UploadersLib.Uploader.SendRequestFile(String url, Stream data, String fileName, String fileFormName, Dictionary`2 args, NameValueCollection headers, CookieCollection cookies, HttpMethod method, String contentType, String relatedData)
2024-03-16 20:31:55.456 - Task failed. File name: librewolf_LAK5cATxMe.png, Errors:
Error message:
The remote server returned an error: (413) Request Entity Too Large.
Request URL:
https://xbb.soda64.com/upload
Status code:
(413) Request Entity Too Large
Headers:
Connection: keep-alive
Content-Length: 176
Content-Type: text/html
Date: Sat, 16 Mar 2024 17:31:54 GMT
Server: nginx
Response text:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at ShareX.UploadersLib.Uploader.SendRequestFile(String url, Stream data, String fileName, String fileFormName, Dictionary`2 args, NameValueCollection headers, CookieCollection cookies, HttpMethod method, String contentType, String relatedData)
2024-03-16 20:31:58.935 - File opened: C:\Users\accou\Documents\ShareX\Logs\ShareX-Log-2024-03.txt
Nginx
server {
listen 17486 ssl;
listen [::]:17486 ssl;
ssl_certificate PATH;
ssl_certificate_key PATH;
autoindex on;
index index.php index.html;
root PATH;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include PATH/.config/nginx/includes/*.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY "";
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
}
You use nginx. For nginx, you need to set client_max_body_size which defaults to 1MB.
In you case, you want to set it to client_max_body_size 200M; (200MB)