Skip to content

Self-hosted dereferer: anonymous redirect links

Suparedirect is a small Express server you run yourself. Link through it and the site on the other end gets the visitor without the Referer header, so it cannot tell which page sent them.

A direct link<a href="https://shop.example/pricing">
GET /pricing HTTP/1.1
Host: shop.example
Referer: https://forum.example/
Accept: text/html

shop.example learns that the visitor came from forum.example.

The same link through Suparedirect<a href="https://go.example/?to=https://shop.example/pricing">
GET /pricing HTTP/1.1
Host: shop.example

Accept: text/html

The line is not sent. document.referrer is an empty string.

Both requests are what shop.example receives, with other headers left out. The first one shows the browser default, which sends the origin of the linking page to another site.

One parameter makes an anonymous link

Put the target in to. The server answers GET /?to=<url> and nothing else needs configuring. A bare domain such as example.com gets https:// added in front.

A target that carries its own query string has to be percent-encoded, or everything after the first & is read as a separate parameter and dropped.

https://go.example/?to=https://shop.example/pricing

Your host, then the page to open.

https://go.example/?to=shop.example

Opens https://shop.example.

https://go.example/?to=https%3A%2F%2Fshop.example%2F%3Fa%3D1%26b%3D2

Opens https://shop.example/?a=1&b=2 with both parameters intact.

How the redirect drops the header

  1. The visitor clicks your link. Their browser loads a page from your Suparedirect host, not from the target.
  2. That page arrives with Referrer-Policy: no-referrer as a response header and the same policy as a <meta> tag.
  3. A one-line script sets window.location to the target. The browser applies the page's policy to that navigation and sends no Referer.

The redirect is a script, so it needs JavaScript. With JavaScript turned off the visitor stays on a blank page.

The full mechanism and its limits
The response from src/index.ts, other headers trimmed
$ curl -i 'http://localhost:3000/?to=https://example.com'
HTTP/1.1 200 OK
Referrer-Policy: no-referrer
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
  <head>
    <meta name="referrer" content="no-referrer">
  </head>
  <body>
    <script>
      window.location = "https://example.com";
    </script>
  </body>
</html>

What it hides, and what it does not

A dereferer removes one piece of information. It is not a proxy or a VPN. The visitor's browser still connects to the target directly.

The target no longer gets

  • The Referer request header, including the origin
  • A value in document.referrer

The target still gets

  • The visitor's IP address and user agent
  • Everything in the target URL, such as query strings and tracking parameters
  • Its own cookies for that visitor

Your server gets

  • The Referer of the page that held the link, which it does not store
  • The target URL, the time and the user agent, kept in memory for the last 500 redirects

A dashboard for the redirects it served

The image also serves a React dashboard on port 5173. It reads GET /api/stats every 5 seconds and lists the redirects held in memory. The counts reset when the process restarts.

Suparedirect stats dashboard with total redirects, records in memory, last redirect and an empty redirect history
What each number means

Run it

The image is halitsever/suparedirect:latest on Docker Hub. The redirect server listens on port 3000 and the dashboard on 5173. Publish only 3000 if you do not want the dashboard.

From source you need Node.js and two installs, one for the server and one for the dashboard.

Step by step in the getting started guide
Docker
# redirect server and dashboard
docker run -p 3000:3000 -p 5173:5173 halitsever/suparedirect:latest

# redirect server only
docker run -p 3000:3000 halitsever/suparedirect:latest
From source
git clone https://github.com/halitsever/suparedirect.git
cd suparedirect
npm i && npm run dashboard:install
npm run build && npm run start

You may not need a redirect at all

If you control the page that holds the link, rel="noreferrer" on the link or a Referrer-Policy header on the page gives the same result with no extra hop.

Suparedirect is for links on pages you cannot edit: a forum post, a wiki page, a chat message, a CMS you do not run. There you can only choose the URL, so the URL has to do the work.

Compare the three options
Enough on a page you control
<a href="https://shop.example/pricing" rel="noreferrer">Pricing</a>

<!-- or for every link on the page -->
<meta name="referrer" content="no-referrer">

Guides