Add Onion-Location header for Tor Browser discovery.

Mirror NullCart's ONION_HOSTNAME env and nginx clearnet header so visitors on HTTPS see ".onion available".
This commit is contained in:
2026-09-11 16:27:36 +02:00
parent 169bbb8bad
commit ebfe68c132
4 changed files with 19 additions and 1 deletions
+2
View File
@@ -18,6 +18,8 @@ server {
ssl_certificate /etc/nginx/certs/live/${CLEARNET_DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/${CLEARNET_DOMAIN}/privkey.pem;
${ONION_LOCATION_HEADER}
root /usr/share/nginx/html;
index index.html;
+8 -1
View File
@@ -2,7 +2,14 @@
set -eu
export CLEARNET_DOMAIN
envsubst '${CLEARNET_DOMAIN}' \
if [ -n "${ONION_HOSTNAME:-}" ]; then
export ONION_LOCATION_HEADER="add_header Onion-Location \"http://${ONION_HOSTNAME}\$request_uri\";"
else
export ONION_LOCATION_HEADER=""
fi
envsubst '${CLEARNET_DOMAIN} ${ONION_LOCATION_HEADER}' \
< /etc/nginx/templates/conf.d/clearnet.conf.template \
> /etc/nginx/conf.d/clearnet.conf