Merge pull request #2317 from dokku/jg-cert-remap-http-to-https
Properly remap http port 80 mappings to https 443 when adding an ssl certificate
This commit is contained in:
@@ -267,7 +267,7 @@ nginx_build_config() {
|
||||
# echo "sigil ${SIGIL_PARAMS[@]}"
|
||||
sigil "${SIGIL_PARAMS[@]}" | cat -s > "$NGINX_CONF"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
if (is_deployed "$APP"); then
|
||||
dokku_log_info1 "Creating $SCHEME nginx.conf"
|
||||
mv "$NGINX_CONF" "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
else
|
||||
@@ -275,7 +275,7 @@ nginx_build_config() {
|
||||
rm -f "$NGINX_CONF"
|
||||
fi
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
if (is_deployed "$APP"); then
|
||||
dokku_log_info1 "Running nginx-pre-reload"
|
||||
plugn trigger nginx-pre-reload "$APP" "$DOKKU_APP_LISTEN_PORT" "$DOKKU_APP_LISTEN_IP"
|
||||
|
||||
@@ -294,7 +294,7 @@ nginx_build_config() {
|
||||
dokku_log_info1 "deleting nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
if (is_deployed "$APP"); then
|
||||
dokku_log_info1 "reloading nginx after nginx.conf deletion"
|
||||
validate_nginx && restart_nginx
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,10 @@ nginx_post_certs_remove() {
|
||||
local trigger="nginx_post_certs_remove"
|
||||
local APP="$1"
|
||||
if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_PORT DOKKU_NGINX_SSL_PORT DOKKU_PROXY_PORT_MAP
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_SSL_PORT
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
remove_proxy_ports "$APP" $(filter_app_proxy_ports "$APP" "https" "443")
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,12 @@ nginx_post_certs_update() {
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_SSL_PORT
|
||||
fi
|
||||
if [[ "$DOKKU_PROXY_PORT_MAP" == *http:80:* ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_PROXY_PORT_MAP
|
||||
# shellcheck disable=SC2046
|
||||
remove_proxy_ports "$APP" $(filter_app_proxy_ports "$APP" "https" "443")
|
||||
# shellcheck disable=SC2046
|
||||
for port_map in $(filter_app_proxy_ports "$APP" "http" "80"); do
|
||||
add_proxy_ports "$APP" "https:443:$(cut -d ':' -f3 <<< "$port_map")"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
nginx_proxy_disable() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
nginx_proxy_enable() {
|
||||
|
||||
Reference in New Issue
Block a user