Hi,
I recently noticed some strange behaviour with rustypaste when dealing with large amounts of data.
It happens at the end when it should actually be 100%.
Kooha/Kooha-2025-10-21-20-23-36.mkv => Upload error: `<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html> (status code: 502)`
Here's what's in the error log.
2025/10/23 15:13:16 [error] 422289#422289: *350865 upstream prematurely closed connection while reading response header from upstream, client: XXXXX, server: YYYYYY, request: "POST / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "YYYYYY"
I'm currently not using a CDN, so it's a direct connection.
Here's the NGNX config.
upstream rpaste {
server 127.0.0.1:8000;
keepalive 250;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name YYYYYY;
}
location / {
proxy_pass http://rpaste/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_headers_hash_bucket_size 128;
proxy_http_version 1.1;
proxy_max_temp_file_size 4096M;
client_body_temp_path /tmp;
client_max_body_size 3500M;
client_body_buffer_size 20M;
client_body_in_file_only clean;
keepalive_timeout 165;
proxy_connect_timeout 5500s;
proxy_send_timeout 5500s;
proxy_read_timeout 5500s;
send_timeout 5500s;
proxy_redirect off;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
I've tried several times now and always get the same error.
I have already configured ngnix specifically so that it stores uploads in tmp files and not in the RAM. That was the initial error (insufficient RAM). However, this only helped with smaller data files.
It appears that rustypaste is somehow ‘timed out’.
Here is my config.toml
[config]
refresh_rate = "1s"
[server]
address = "127.0.0.1:8000"
workers=6
max_content_length = "3500MB"
upload_path = "./upload"
timeout = "5500s"
expose_version = false
expose_list = true
auth_tokens = [
"super_secret_token",
]
delete_tokens = [
"super_secret_token"
]
handle_spaces = "replace" # or "encode"
max_upload_dir_size = "3500M"
[landing_page]
text = """
┬─┐┬ ┬┌─┐┌┬┐┬ ┬┌─┐┌─┐┌─┐┌┬┐┌─┐
├┬┘│ │└─┐ │ └┬┘├─┘├─┤└─┐ │ ├┤
┴└─└─┘└─┘ ┴ ┴ ┴ ┴ ┴└─┘ ┴ └─┘
Private instance only (auth):
The server administrator might remove any pastes that they do not personally
want to host.
"""
#file = "index.txt"
content_type = "text/plain; charset=utf-8"
[paste]
random_url = { type = "petname", words = 2, separator = "-" }
#random_url = { type = "alphanumeric", length = 8 }
#random_url = { type = "alphanumeric", length = 6, suffix_mode = true }
default_extension = "txt"
mime_override = [
{ mime = "image/jpeg", regex = "^.*\\.jpg$" },
{ mime = "image/png", regex = "^.*\\.png$" },
{ mime = "image/svg+xml", regex = "^.*\\.svg$" },
{ mime = "video/webm", regex = "^.*\\.webm$" },
{ mime = "video/x-matroska", regex = "^.*\\.mkv$" },
{ mime = "application/octet-stream", regex = "^.*\\.bin$" },
{ mime = "text/plain", regex = "^.*\\.(log|txt|diff|sh|rs|toml)$" },
]
mime_blacklist = [
"application/x-dosexec",
"application/java-archive",
"application/java-vm",
"application/vnd.apple.installer+xml",
"application/x-msdownload",
]
duplicate_files = true
default_expiry = "1h"
delete_expired_files = { enabled = true, interval = "1h" }
Any ideas?
Hi,
I recently noticed some strange behaviour with rustypaste when dealing with large amounts of data.
It happens at the end when it should actually be 100%.
Here's what's in the error log.
I'm currently not using a CDN, so it's a direct connection.
Here's the NGNX config.
I've tried several times now and always get the same error.
I have already configured ngnix specifically so that it stores uploads in tmp files and not in the RAM. That was the initial error (insufficient RAM). However, this only helped with smaller data files.
It appears that rustypaste is somehow ‘timed out’.
Here is my config.toml
Any ideas?