Advertise the onion site on clearnet via Onion-Location header.

This commit is contained in:
2026-09-11 15:26:03 +02:00
parent 08a0bdcdb8
commit 77cd686347
4 changed files with 26 additions and 0 deletions
+15
View File
@@ -16,6 +16,21 @@ render_server() {
surface="$3"
SHOP_SURFACE="$surface"
export SHOP_SURFACE CLEARNET_DOMAIN BACKEND_PORT
if [ "$surface" = "clearnet" ]; then
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} ${BACKEND_PORT} ${SHOP_SURFACE} ${ONION_LOCATION_HEADER}' \
< "$template_path" \
> "$output_path"
return
fi
envsubst '${CLEARNET_DOMAIN} ${BACKEND_PORT} ${SHOP_SURFACE}' \
< "$template_path" \
> "$output_path"