Overview
Running copyparty behind a reverse proxy provides several benefits:- Automatic HTTPS/TLS certificate management
- HTTP/2 and HTTP/3 support
- Better isolation and security
- Host multiple services on the same ports (80/443)
- Load balancing and caching capabilities
Configuration Methods
You can deploy copyparty behind a reverse proxy in two ways:Subdomain Proxying (Recommended)
Dedicate a subdomain to copyparty:https://files.example.com→ copyparty- Simpler configuration
- Better performance
- Fewer edge cases
Path-Based Proxying
Mount copyparty under a path:https://example.com/files→ copyparty- Requires
--rp-loc /filesargument - Slight performance cost
- More complex setup
Client IP Detection
Copyparty needs to know the real client IP for rate limiting, bans, and logging.1
Configure your reverse proxy
Ensure your proxy sends the correct header:
- Most proxies:
X-Forwarded-For - Cloudflare:
CF-Connecting-IP - Custom: Any header name you configure
2
Configure copyparty
Tell copyparty which header to trust:Header contains single IP (most cases):Header contains multiple IPs (CDN chain):
nginx Configuration
Recommended for best performance and compatibility.Subdomain Setup
1
Start copyparty with unix socket
Using unix sockets is 5-10% faster and more secure:Or with TCP:
2
Create nginx configuration
Create
/etc/nginx/conf.d/copyparty.conf:3
Configure copyparty
4
SELinux (Fedora/RHEL)
Allow nginx to connect:
5
Test and reload
Path-Based Setup
For mounting copyparty at a subpath like/files:
Cloudflare + nginx
If using Cloudflare in front of nginx:1
Restrict to Cloudflare IPs
Generate and include Cloudflare IP allowlist:
2
Update nginx config
3
Configure copyparty
Apache Configuration
1
Enable required modules
2
Create virtual host
Create
/etc/apache2/sites-available/copyparty.conf:3
Enable site
4
SELinux (Fedora/RHEL)
Caddy Configuration
Caddy automatically handles HTTPS certificates via Let’s Encrypt.Subdomain Setup
Path-Based Setup
--rp-loc /files.
Command-Line Usage
Cloudflare Tunnel
For quick deployment without exposing ports or managing certificates:1
Install cloudflared
2
Quick tunnel (temporary URL)
https://random-words.trycloudflare.com.3
Permanent tunnel (custom domain)
- Go to Cloudflare Dashboard → Zero Trust → Networks → Tunnels
- Create a tunnel → Cloudflared
- Choose subdomain (e.g.,
files.example.com) - Service type:
HTTP, URL:127.0.0.1:3923 - Copy and run the provided command
4
Configure copyparty for Cloudflare
Cloudflare Tunnels work well with CGNAT and restrictive firewalls since they establish outbound connections.
Performance Comparison
Benchmark results using unix sockets:Unix sockets provide 5-10% better performance than TCP connections.
Troubleshooting
Incorrect —rp-loc Error
Error:incorrect --rp-loc or webserver config; expected vpath starting with [...]
Cause: Proxy is stripping the location prefix from URLs.
Solution: Ensure the proxy passes the full path:
Thumbnails Return 404
Cause: Proxy strips query parameters (?th=w).
Solution: Check proxy cache settings and URL rewrite rules.
Getting Banned Immediately
Cause: Client IP detection is wrong, proxy IP is getting banned. Solution:- Check copyparty logs for helpful messages
- Verify
--xff-hdr,--xff-src, and--rproxysettings - See docs/xff.md
502 Bad Gateway
Causes:- Copyparty isn’t running
- Wrong socket/port configuration
- Permissions issue with unix socket
Upload Fails with Large Files
Cause: Proxy timeout or size limits. Solution:SSL/TLS Best Practices
Let’s Encrypt with Certbot
Manual SSL Configuration
For nginx:Next Steps
Security Hardening
Harden your reverse proxy setup
Docker Deployment
Run behind proxy in Docker
Systemd Service
Configure systemd service