feat(nginx-proxy): allow disabling hsts globally and explicitly enabling it per app
https://github.com/dokku/dokku/pull/3843
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
6ab9f28d77
commit
8cc92680c5
@@ -45,6 +45,8 @@ cmd-nginx-report-single() {
|
||||
"--nginx-client-max-body-size: $(fn-plugin-property-get-default "nginx" "$APP" "client-max-body-size" "")"
|
||||
"--nginx-disable-custom-config: $(fn-plugin-property-get-default "nginx" "$APP" "disable-custom-config" "false")"
|
||||
"--nginx-error-log-path: $(fn-nginx-error-log-path "$APP")"
|
||||
"--nginx-global-hsts: $(fn-plugin-property-get-default "nginx" "--global" "hsts" "true")"
|
||||
"--nginx-applied-hsts: $(fn-plugin-property-get-default "nginx" "$APP" "hsts" "$(fn-plugin-property-get-default "nginx" "--global" "hsts" "true")")"
|
||||
"--nginx-hsts: $(fn-plugin-property-get-default "nginx" "$APP" "hsts" "true")"
|
||||
"--nginx-hsts-include-subdomains: $(fn-plugin-property-get-default "nginx" "$APP" "hsts-include-subdomains" "true")"
|
||||
"--nginx-hsts-max-age: $(fn-plugin-property-get-default "nginx" "$APP" "hsts-max-age" "15724800")"
|
||||
|
||||
@@ -13,9 +13,21 @@ fn-nginx-vhosts-last-visited-at() {
|
||||
fi
|
||||
}
|
||||
|
||||
fn-nginx-hsts-is-applied() {
|
||||
declare APP="$1"
|
||||
# if hsts is disabled globally then only apply it if an app has it set explicitly
|
||||
if [[ "$(fn-plugin-property-get-default "nginx" "--global" "hsts" "true")" == "false" ]] && \
|
||||
[[ "$(fn-plugin-property-get-default "nginx" "$APP" "hsts" "false")" == "false" ]]; then
|
||||
echo "false";
|
||||
return;
|
||||
fi
|
||||
# if app has explicitly turned it off else it is default on
|
||||
echo $(fn-plugin-property-get-default "nginx" "$APP" "hsts" "true");
|
||||
}
|
||||
|
||||
fn-nginx-vhosts-manage-hsts() {
|
||||
declare APP="$1" SSL_ENABLED="$2"
|
||||
local HSTS="$(fn-plugin-property-get-default "nginx" "$APP" "hsts" "true")"
|
||||
local HSTS="$(fn-nginx-hsts-is-applied "$APP")"
|
||||
local HSTS_INCLUDE_SUBDOMAINS="$(fn-plugin-property-get-default "nginx" "$APP" "hsts-include-subdomains" "true")"
|
||||
local HSTS_MAX_AGE="$(fn-plugin-property-get-default "nginx" "$APP" "hsts-max-age" "15724800")"
|
||||
local HSTS_PRELOAD="$(fn-plugin-property-get-default "nginx" "$APP" "hsts-preload" "false")"
|
||||
|
||||
Reference in New Issue
Block a user