From b8019421696ceae125019b9dbf9ff096d199bea3 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 22 Jan 2021 13:02:39 +0000 Subject: [PATCH] Add rule to forward to user portal --- entrypoint.sh | 3 ++- nginx/https.template | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f66981c..75bf054 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,11 +5,12 @@ CERT_PATH="/snikket/letsencrypt/live/$SNIKKET_DOMAIN/cert.pem" export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80} export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443} export SNIKKET_TWEAK_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_INTERNAL_HTTP_PORT-5280} +export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT-8000} if test -f "$CERT_PATH"; then ## Certs already exist - render and deploy configs for proto in http https; do - envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT' \ + envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT' \ < /etc/nginx/templates/$proto \ > /etc/nginx/sites-enabled/$proto; done diff --git a/nginx/https.template b/nginx/https.template index e7ea42d..ece1b6d 100644 --- a/nginx/https.template +++ b/nginx/https.template @@ -15,6 +15,13 @@ server { server_name groups.${SNIKKET_DOMAIN}; server_name share.${SNIKKET_DOMAIN}; + location /portal { + proxy_pass http://localhost:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT}/; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + } + location / { proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}/; proxy_set_header Host $host;