URL Cleaner Site
Documentation for URL Cleaner in general
A simple HTTP server to allow using URL Cleaner in web browser userscripts and other applications where SSH tunnels are infeasable.
Licensed under the Affero General Public License V3 or later (SPDX: AGPL-3.0-or-later)
https://www.gnu.org/licenses/agpl-3.0.html
Usage
The main way to use URL Cleaner Site is with its userscript, url-cleaner-site-userscript.js.
Once you have URL Cleaner Site running on your computer, you can install the userscript using Greasemonkey (for Firefox), Tampermonkey (for chrome, edge, Firefox, safari, and opera), Userscripts (for safari), or any other userscript browser extension.
I personally use Greasemonkey for Firefox on Linux and Userscripts for ios safari to avoid tampermonkey's telemetry and weird lag.
The userscript should work on all of the above extensions on all platforms they support.
Other devices
By default URL Cleaner Site will only accept traffic from the computer it's running on. If you want to use URL Cleaner site on another computer/phone:
-
Start URL Cleaner Site with
--bind 0.0.0.0to make it accept requests from any computer on its network. -
Before installing the userscript to your phone, first find the
// @connect localhostandinstance: "http://localhost:9149"lines near the top and changelocalhostto the local IP of the computer running URL Cleaner Site. Usually the IP looks like192.168.x.x,10.x.x.x, or172.16.x.x. -
Optional but useful: Tell your router to always give the computer your instacne is running on the same local IP. On my router this feature is under "Basic", "LAN Setup", then "DHCP Reservation" and maps MAC addresses to IPs. Your router shouldn't ever randomly reassign you, especially if you're using a computer that's always online, but it does happen sometimes.
Once you've done that, your phone should be using URL Cleaner Site as long as it can see the server. If you want to use your instance globally you should use accounts and HTTPS.
Profiles
To unify behavior across many clients, you can use profiles.
The ProfileConfig is a JSON file like this:
Using the base profile will enable the flag you always want flag, while using profile name 1 will also enable the flag you only sometimes want flag.
Accounts
If you want to use URL Cleaner Site everywhere, it should be safe to host a public instance using HTTPS accounts.
An accounts file looks like
and is specified using --accounts accounts-file.json.
When no accounts file is specified, it defaults to no accounts and allowing guests.
To adjust URL Cleaner Site Userscript to use accounts, find the auth: null near the top and replace it with auth: {"username": "Your username", "password": "Your password"}.
PLEASE note that there is currently no way to limit what an account can do. It's easy for a malicious user to ask your instance to clean a ton of redirect URLs in parallel, which can result in your instance's IP getting banned from that website.
Please also note that public instances should always use TLS (see below) to stop malicious networks from stealing your login details. By manually installing your self-signed certificate onto your devices using URL Cleaner Site, any router trying to use its own certificate will result in your device throwing errors and refusing to connect.
HTTPS
HTTPS can be used with the --key and --cert arguments.
To generate a public/private key pair, use the following OpenSSL commands with YOUR_IP changed to your instances local IP, which is usually 192.168.x.x, 10.x.x.x, or 172.16.x.x.
You can add more IP=1.2.3.4 and DNS:example.com to the list for public instances.
Please note that HTTPS requires changing window.URL_CLEANER_SITE = "http://localhost:9149"; in the userscript to from http to https.
Installing the certificate
Ios
-
Get the
url-cleaner-site.crtfile onto your iphone and open it such that you get a popup with "Profile Downloaded". -
Open settings. Either tap the "Profile Downloaded" button at the top or, if it's not there, tap "General", scroll all the way down, then tap "VPN & Device Management"
-
Tap "URL Cleaner Site" under "Downloaded Profile".
-
Tap "Install" in the top right, authenticate, tap "Install" in the top right, then tap "Install" at the bottom, then tap "Done".
-
Go back one level (back into the "General" settings), scroll all the way up, tap "About", scroll all the way down, tap "Ceritifcate Trust Settings", find "URL Cleaner Site" under "Enable Full Trust For Root Certificate", then enable it.
Linux
Firefox
For some reason, at least on my computer, Firefox ignores the above Linux setup. Simply opening https://localhost:9149, clicking "Advanced...", then clicking "Accept the Risk and Continue" seems to work fine.
Please note that due to a bug in Greasemonkey, setting about:config's privacy.firstparty.isolate to true (as is default in forks like Mullvad Browser) breaks the userscript.
mTLS
mTLS is an addition to HTTPS that lets servers require clients to have their own public/private key pair to prove their identity.
Unlike the account system, mTLS makes it impossible for unauthorized people to connect to the server at all.
While URL Cleaner Site should support mTLS, I've yet to do any proper testing because nothing makes it easy to use.
API
The main API is sending a POST request to /clean with a JSON payload of url_cleaner_site_types::JobConfig.
The only required field is tasks, but a fully filled JobConfig looks like this:
tasks: A list ofLazyTaskConfigs to do. Usually either the URL as a string or an object with the URL and some context for the cleaner to use.auth(optional): An username and password pair for use with accounts.context(optional): AnJobContextfor the cleaner to use for all tasks.profile(optional): The name of the profile to use. Profiles are used to pre-compute, name, and share between frontendsParamsDiffs you often want to use.params_diff(optional): AParamsDiffto apply on top of the (also optional) profile.cache_delay(optional): Iftrue, enable artificial cache delays to stop anything that can measure the time a cleaning takes from noticing if a task is cached. Iffalsedisables it. If omitted, uses the default value set by the server Iffalsedisables it. If omitted, uses the default value set by the server.hide_thread_count(optional): Iftrue, make cache reads and network requests single threaded to stop anything that can measure the time a cleaning takes from figuring out how many threads the server has. Iffalsedisables it. If omitted, uses the default value set by the server Iffalsedisables it. If omitted, uses the default value set by the server.
The following other endpoints also exist:
/get-cleaner(GET): Get the cleaner used in/clean./get-profiles(GET): Get the names and configuration of the available profiles./get-max-json-size(GET): Get the maximum size of the JSON you can send to/clean.
Performance
Due to the overhead of using HTTP, the lack of streaming tasks and results, and optionally TLS, performance is significantly worse than the CLI.
The following numbers use curl instead of the userscript to avoid the noise of browsers these days being comically slow.
On the same laptop used in URL Cleaner's example benchmarks and without TLS, hyperfine (using CURL) gave me the following benchmarks:
Last updated 2025-09-12.
And with TLS: