Onion-Location: redirect your clearnet website to .onion

Supported in Tor Browser >=9.5

  1. Caddy
  2. Netlify
  3. tag
  4. Apache and Nginx

Tor Browser recently introduced “Onion Location” feature in v9.5 to enable a (clearnet) website to advertise its onion service to users of Tor Browser by adding an HTTP header. When visiting a clearnet website that has onion service available and the relevant HTTP header, Tor Browser will display a “.onion available” button on the address bar. When user clicks on it, Tor Browser will redirects to the .onion address of the website. User could also opt-in the “Always Prioritise Onions” option and Tor Browser will automatically redirects to a website’s .onion if detected. This feature was initially suggested back in 2017 and finally landed in v9.5.

.onion button

Redirected to onion service

The HTTP header is:

Onion-Location: http://xxx.onion

Caddy §

In Caddy, the header can be added by:

example.com { header / { Onion-Location "http://xxx.onion" } }
example.com { header { Onion-Location "http://xxx.onion" } }

Netlify §

Add custom header by using _headers file saved the root folder of your site:

/* Onion-Location: http://xxx.onion

tag §

If you don’t have access to the web server to add the header (e.g. GitHub/GitLab Pages), you can add <meta> tag instead.

The tag should be added in <head>:

    <meta http-equiv="Onion-Location" content="http://xxx.onion">

Apache and Nginx §

Refer to this configuration guide on Tor Project website.