Proxy file downloads from selected hosts through YOURLS or a dedicated proxy server, while keeping normal HTML pages as standard redirects.
When a short URL is clicked, the plugin can:
- stream file content instead of redirecting to the final file URL;
- offload file traffic to an external proxy server;
- redirect HTML pages normally (no HTML proxying);
- restrict proxying to an allowlist of target hosts.
This helps when you need controlled download behavior, more privacy for destination URLs, or traffic offloading from your main YOURLS server.
- YOURLS
1.9.2+(plugin was built for this setup) - PHP
8.0+ - PHP cURL extension (required for local streaming and proxy script fallback)
- Nginx or Apache config only if you enable acceleration mode
- Place the plugin folder in:
user/plugins/agdev-link-proxy/ - Ensure the plugin main file is:
user/plugins/agdev-link-proxy/plugin.php - Open YOURLS Admin ->
Manage Pluginsand activateLink Proxy. - Open plugin settings page:
admin/plugins.php?page=link_proxy
- Enable
Link Proxy. - Add
Target domains(one per line or comma-separated), for example:example.com*.example.com
- Keep
Proxy URLandShared Secretempty. - Set timeout / redirect limits as needed.
- Save settings.
Result: matching file URLs are streamed from your YOURLS server; HTML pages are redirected as normal.
- Set
Proxy URL(for examplehttps://proxy.example.com). - Set
Shared Secret. - Save settings.
- Click
Download agdev-link-proxy.phpon the plugin page. - Deploy downloaded
agdev-link-proxy.phpon your proxy host. - Apply the Nginx/Apache snippets shown on the plugin page.
Result: YOURLS redirects clicks to your proxy endpoint (/_lp/<keyword>), and the proxy host serves files.
- Plugin hooks into YOURLS
redirect_shorturl. - If
External Proxyis configured, YOURLS builds a signed proxy URL and sends a302to proxy host. - If external proxy is not configured:
- plugin validates host against your allowlist;
- detects HTML responses and keeps normal redirect behavior;
- for files, streams content locally (with optional acceleration).
agdev-link-proxy.php:
- accepts requests on
/_lp/<keyword>; - validates
ts+sig(HMAC SHA-256, max skew600s); - expands keyword to long URL through YOURLS API;
- validates scheme and allowed host;
- redirects HTML pages to original URL;
- serves files via:
- Apache acceleration (
mod_proxyrewrite), or - Nginx
X-Accel-Redirect, or - cURL streaming fallback.
- Apache acceleration (
- Allowed hosts support wildcards like
*.example.com. - Wildcard matches subdomains, not the root domain itself.
TimeoutandMax redirectsaffect local streaming behavior.- Apache secret can be rotated from the plugin
Toolssection. - The plugin sends no-store headers for proxied responses.
Link Proxy requires the PHP cURL extension: install/enablephp-curl.Host not allowed: add destination host toTarget domains.- External proxy returns
Missing signature/Bad signature: verifyShared Secretmatches between YOURLS and deployedagdev-link-proxy.php. - Nginx/Apache acceleration not working: verify server snippets were applied exactly as shown in plugin page.
- Only HTTP/HTTPS schemes are accepted.
- Host allowlist is enforced before proxying.
- External requests are signed and time-limited.
- Shared secrets should be long and random.
MIT License. See LICENSE.