Support custom host for prosody/portal

This commit is contained in:
Matthew Wild 2021-02-17 13:07:37 +00:00
parent d4e9efb758
commit cc0aa1ff90
3 changed files with 13 additions and 6 deletions

View File

@ -36,7 +36,7 @@ server {
location /upload/ {
client_max_body_size 16M;
proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT};
proxy_pass http://${SNIKKET_TWEAK_INTERNAL_HTTP_HOST}:${SNIKKET_TWEAK_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;

View File

@ -29,14 +29,14 @@ location /upload {
}
location @portal {
proxy_pass http://localhost:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT};
proxy_pass http://${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST}:${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 @prosody {
proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT};
proxy_pass http://${SNIKKET_TWEAK_INTERNAL_HTTP_HOST}:${SNIKKET_TWEAK_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;

View File

@ -1,10 +1,17 @@
#!/bin/bash
export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80}
export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443}
# Prosody host/port
export SNIKKET_TWEAK_INTERNAL_HTTP_HOST=${SNIKKET_TWEAK_INTERNAL_HTTP_HOST-localhost}
export SNIKKET_TWEAK_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_INTERNAL_HTTP_PORT-5280}
# Portal host/port
export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST-localhost}
export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT-5765}
exec envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT' \
# External ports
export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80}
export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443}
exec envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_HOST $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST' \
< "$1" \
> "$2";