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:
@@ -1,2 +1,3 @@
|
|||||||
COMPOSE_PROJECT_NAME=nullcart_promo_prod
|
COMPOSE_PROJECT_NAME=nullcart_promo_prod
|
||||||
CLEARNET_DOMAIN=nullcart.net
|
CLEARNET_DOMAIN=nullcart.net
|
||||||
|
ONION_HOSTNAME=samplexxxxxxxxx.onion
|
||||||
|
|||||||
@@ -114,6 +114,14 @@ Save and exit the editor. Optional — run once manually to verify:
|
|||||||
./deploy/scripts/show-onion.sh
|
./deploy/scripts/show-onion.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Copy the hostname into `.env.prod` as `ONION_HOSTNAME`, then recreate nginx:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose --env-file .env.prod -f docker-compose.prod.yml up -d --force-recreate nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
Tor Browser will then show ".onion available" when visitors open the clearnet site over HTTPS.
|
||||||
|
|
||||||
### 9. Updates
|
### 9. Updates
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ server {
|
|||||||
ssl_certificate /etc/nginx/certs/live/${CLEARNET_DOMAIN}/fullchain.pem;
|
ssl_certificate /etc/nginx/certs/live/${CLEARNET_DOMAIN}/fullchain.pem;
|
||||||
ssl_certificate_key /etc/nginx/certs/live/${CLEARNET_DOMAIN}/privkey.pem;
|
ssl_certificate_key /etc/nginx/certs/live/${CLEARNET_DOMAIN}/privkey.pem;
|
||||||
|
|
||||||
|
${ONION_LOCATION_HEADER}
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,14 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
export CLEARNET_DOMAIN
|
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/templates/conf.d/clearnet.conf.template \
|
||||||
> /etc/nginx/conf.d/clearnet.conf
|
> /etc/nginx/conf.d/clearnet.conf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user