How do I add an Onion-Location
header to all my pages in Caddy2 the value of which is $string+request_path
Onion-Location is an easy way to advertise an onion site to the users. You can either configure a web server to show an Onion-Location Header or add an HTML meta attribute in the website.
The example Nginx configuration shows:
add_header Onion-Location http://<your-onion-address>.onion$request_uri;
I think they meant path, rather than full URI.
Like this:
header Onion-Location http://whatevercrypticname.onion{path}
If you have the $TOR_HOSTNAME
saved as an environment variable then use
header Onion-Location http://{$TOR_HOSTNAME}{path}