RustinxRustinx

Server Settings

The [server] section controls how Rustinx listens for connections and manages resources.

Full Reference

rustinx.toml
[server]
listen = "0.0.0.0:9090"       # Address and port to bind
behind_proxy = false           # Trust X-Forwarded-For headers
trusted_proxy_depth = 1        # Number of proxy hops to trust
max_connections = 1024         # Max concurrent connections
connection_timeout = 30        # Seconds before killing idle connections
max_file_size = 52428800       # Max file size in bytes (50MB)

listen

The address and port Rustinx binds to.

ValueMeaning
"0.0.0.0:9090"All interfaces, port 9090 (default)
"127.0.0.1:9090"Localhost only
"0.0.0.0:8080"All interfaces, port 8080

behind_proxy

When true, Rustinx reads the client IP from X-Forwarded-For or X-Real-IP headers instead of the TCP connection. Only enable this when Rustinx is behind a trusted reverse proxy.

Default: false

[server]
behind_proxy = true
trusted_proxy_depth = 1  # Traefik = 1 hop

The trusted_proxy_depth controls which IP to extract from the X-Forwarded-For chain. It counts from the right:

X-Forwarded-For: client, traefik
                   ^--- depth=1 picks this one

If the chain is shorter than the configured depth, Rustinx falls back to the direct connection IP. This prevents spoofing.

Range: trusted_proxy_depth must be 1-16.

Resource Limits

These limits protect the server from resource exhaustion:

SettingDefaultRangePurpose
max_connections10241-4096Max concurrent TCP connections
connection_timeout301-3600Seconds before killing a connection
max_file_size52428800 (50MB)1-1073741824 (1GB)Largest file that will be served

Files larger than max_file_size return 413 File Too Large.

Example: Low-resource container

[server]
max_connections = 64
connection_timeout = 10
max_file_size = 10485760  # 10MB

On this page