Search code examples
apachehttphttp-headerstor

How can I set up HTTP Alternative Service in Apache?


I run a website on the clearnet using Apache and want the connection to be made via the .onion address when a user uses the clearnet URL in a Tor browser.

I know Facebook uses a standard called HTTP Alternative Service, but I don't know how I should implement it myself in Apache.


Solution

  • I found a solution, however can't verify if it actually works as intended.

    One can add the header in the .htaccess file by adding

    Header add Alt-Svc: h2="example.onion:80"
    

    to the file.

    This does in fact add the Alt-Svc header to the responses, however the standard specifies the URL shown to the user in the browser should remain unchanged, despite the connection actually happening on Alt-Svc.

    Thus I have so far unable to verify whether the Tor Browser actually connects on the .onion as intended.