Fix Onion-Location on SPA responses behind nginx add_header.
Render the header inside location / so it is not dropped by other location headers; remove the ineffective server-level directive.
This commit is contained in:
@@ -9,7 +9,9 @@ UPLOAD_MAX_REQUEST_BODY_BYTES=$(( (max_image_bytes * 4 + 2) / 3 + json_padding )
|
||||
export UPLOAD_MAX_REQUEST_BODY_BYTES BACKEND_PORT
|
||||
|
||||
render_locations() {
|
||||
envsubst '${BACKEND_PORT} ${UPLOAD_MAX_REQUEST_BODY_BYTES}' \
|
||||
export ONION_LOCATION_HEADER="add_header Onion-Location \"http://${ONION_HOSTNAME}\$request_uri\" always;"
|
||||
|
||||
envsubst '${BACKEND_PORT} ${UPLOAD_MAX_REQUEST_BODY_BYTES} ${ONION_LOCATION_HEADER}' \
|
||||
< /etc/nginx/templates/snippets/private-image-locations.conf.template \
|
||||
> /etc/nginx/snippets/private-image-locations.conf
|
||||
}
|
||||
@@ -20,15 +22,9 @@ render_server() {
|
||||
surface="$3"
|
||||
|
||||
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
|
||||
|
||||
export CLEARNET_DOMAIN
|
||||
|
||||
envsubst '${CLEARNET_DOMAIN} ${ONION_LOCATION_HEADER}' \
|
||||
|
||||
envsubst '${CLEARNET_DOMAIN}' \
|
||||
< "$template_path" \
|
||||
> "$output_path"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user