Advertise the onion site on clearnet via Onion-Location header.
This commit is contained in:
@@ -18,5 +18,7 @@ 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}
|
||||
|
||||
include /etc/nginx/snippets/nullcart-locations-${SHOP_SURFACE}.conf;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user