fix: use updated http2 directive for setting http2 support
Closes #7997
This commit is contained in:
@@ -181,6 +181,9 @@ is_http2_push_enabled() {
|
|||||||
elif [[ "$MINOR_VERSION" -ge "14" ]]; then
|
elif [[ "$MINOR_VERSION" -ge "14" ]]; then
|
||||||
HAS_SUPPORT=true
|
HAS_SUPPORT=true
|
||||||
fi
|
fi
|
||||||
|
if [[ "$MINOR_VERSION" -eq "25" ]]; then
|
||||||
|
HAS_SUPPORT=false
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $HAS_SUPPORT
|
echo $HAS_SUPPORT
|
||||||
@@ -208,6 +211,28 @@ is_http2_enabled() {
|
|||||||
echo $HAS_SUPPORT
|
echo $HAS_SUPPORT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_http2_directive_supported() {
|
||||||
|
declare desc="detects whether the installed nginx version has http2 directive support"
|
||||||
|
local NGINX_VERSION="$1"
|
||||||
|
local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
|
||||||
|
local HAS_SUPPORT=false
|
||||||
|
|
||||||
|
MAJOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[1]}')
|
||||||
|
MINOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[2]}')
|
||||||
|
PATCH_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[3]}')
|
||||||
|
if [[ "$MAJOR_VERSION" -ge "2" ]]; then
|
||||||
|
HAS_SUPPORT=true
|
||||||
|
elif [[ "$MAJOR_VERSION" -eq "1" ]]; then
|
||||||
|
if [[ "$MINOR_VERSION" -eq "25" ]] && [[ "$PATCH_VERSION" -ge "1" ]]; then
|
||||||
|
HAS_SUPPORT=true
|
||||||
|
elif [[ "$MINOR_VERSION" -ge "26" ]]; then
|
||||||
|
HAS_SUPPORT=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $HAS_SUPPORT
|
||||||
|
}
|
||||||
|
|
||||||
is_grpc_enabled() {
|
is_grpc_enabled() {
|
||||||
declare desc="detects whether the installed nginx version has grpc support"
|
declare desc="detects whether the installed nginx version has grpc support"
|
||||||
local NGINX_VERSION="$1"
|
local NGINX_VERSION="$1"
|
||||||
@@ -310,7 +335,7 @@ nginx_build_config() {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local NGINX_LOCATION NGINX_VERSION SPDY_SUPPORTED TLS13_SUPPORTED HTTP2_SUPPORTED HTTP2_PUSH_SUPPORTED GRPC_SUPPORTED
|
local NGINX_LOCATION NGINX_VERSION SPDY_SUPPORTED TLS13_SUPPORTED HTTP2_SUPPORTED HTTP2_PUSH_SUPPORTED HTTP2_DIRECTIVE_SUPPORTED GRPC_SUPPORTED
|
||||||
NGINX_LOCATION=$(get_nginx_location)
|
NGINX_LOCATION=$(get_nginx_location)
|
||||||
if [[ -z "$NGINX_LOCATION" ]]; then
|
if [[ -z "$NGINX_LOCATION" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
@@ -320,6 +345,7 @@ nginx_build_config() {
|
|||||||
SPDY_SUPPORTED="false"
|
SPDY_SUPPORTED="false"
|
||||||
TLS13_SUPPORTED="$(is_tls13_available "$NGINX_VERSION")"
|
TLS13_SUPPORTED="$(is_tls13_available "$NGINX_VERSION")"
|
||||||
HTTP2_SUPPORTED="$(is_http2_enabled "$NGINX_VERSION")"
|
HTTP2_SUPPORTED="$(is_http2_enabled "$NGINX_VERSION")"
|
||||||
|
HTTP2_DIRECTIVE_SUPPORTED="$(is_http2_directive_supported "$NGINX_VERSION")"
|
||||||
HTTP2_PUSH_SUPPORTED="$(is_http2_push_enabled "$NGINX_VERSION")"
|
HTTP2_PUSH_SUPPORTED="$(is_http2_push_enabled "$NGINX_VERSION")"
|
||||||
GRPC_SUPPORTED="$(is_grpc_enabled "$NGINX_VERSION")"
|
GRPC_SUPPORTED="$(is_grpc_enabled "$NGINX_VERSION")"
|
||||||
|
|
||||||
@@ -388,6 +414,7 @@ nginx_build_config() {
|
|||||||
NGINX_ERROR_LOG_PATH="$NGINX_ERROR_LOG_PATH"
|
NGINX_ERROR_LOG_PATH="$NGINX_ERROR_LOG_PATH"
|
||||||
NGINX_BIND_ADDRESS_IP4="$NGINX_BIND_ADDRESS_IP4"
|
NGINX_BIND_ADDRESS_IP4="$NGINX_BIND_ADDRESS_IP4"
|
||||||
NGINX_BIND_ADDRESS_IP6="$NGINX_BIND_ADDRESS_IP6"
|
NGINX_BIND_ADDRESS_IP6="$NGINX_BIND_ADDRESS_IP6"
|
||||||
|
HTTP2_DIRECTIVE_SUPPORTED="$HTTP2_DIRECTIVE_SUPPORTED"
|
||||||
HTTP2_PUSH_SUPPORTED="$HTTP2_PUSH_SUPPORTED"
|
HTTP2_PUSH_SUPPORTED="$HTTP2_PUSH_SUPPORTED"
|
||||||
GRPC_SUPPORTED="$GRPC_SUPPORTED"
|
GRPC_SUPPORTED="$GRPC_SUPPORTED"
|
||||||
DOKKU_APP_LISTEN_PORT="$DOKKU_APP_LISTEN_PORT" DOKKU_APP_LISTEN_IP="$DOKKU_APP_LISTEN_IP"
|
DOKKU_APP_LISTEN_PORT="$DOKKU_APP_LISTEN_PORT" DOKKU_APP_LISTEN_IP="$DOKKU_APP_LISTEN_IP"
|
||||||
|
|||||||
@@ -77,8 +77,14 @@ server {
|
|||||||
}
|
}
|
||||||
{{ else if eq $scheme "https"}}
|
{{ else if eq $scheme "https"}}
|
||||||
server {
|
server {
|
||||||
|
{{ if eq $.HTTP2_DIRECTIVE_SUPPORTED "true" }}
|
||||||
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl;
|
||||||
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl;
|
||||||
|
http2 on;
|
||||||
|
{{ else }}
|
||||||
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
|
||||||
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
|
||||||
|
{{ end }}
|
||||||
{{ if $.SSL_SERVER_NAME }}server_name {{ $.SSL_SERVER_NAME }}; {{ end }}
|
{{ if $.SSL_SERVER_NAME }}server_name {{ $.SSL_SERVER_NAME }}; {{ end }}
|
||||||
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
||||||
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
||||||
@@ -155,8 +161,14 @@ server {
|
|||||||
{{ else if eq $scheme "grpc"}}
|
{{ else if eq $scheme "grpc"}}
|
||||||
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
|
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
|
||||||
server {
|
server {
|
||||||
|
{{ if eq $.HTTP2_DIRECTIVE_SUPPORTED "true" }}
|
||||||
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }};
|
||||||
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }};
|
||||||
|
http2 on;
|
||||||
|
{{ else }}
|
||||||
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} http2;
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} http2;
|
||||||
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} http2;
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} http2;
|
||||||
|
{{ end }}
|
||||||
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
||||||
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
||||||
error_log {{ $.NGINX_ERROR_LOG_PATH }};
|
error_log {{ $.NGINX_ERROR_LOG_PATH }};
|
||||||
@@ -172,8 +184,14 @@ server {
|
|||||||
{{ else if eq $scheme "grpcs"}}
|
{{ else if eq $scheme "grpcs"}}
|
||||||
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
|
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
|
||||||
server {
|
server {
|
||||||
|
{{ if eq $.HTTP2_DIRECTIVE_SUPPORTED "true" }}
|
||||||
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl;
|
||||||
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl;
|
||||||
|
http2 on;
|
||||||
|
{{ else }}
|
||||||
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl http2;
|
listen [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl http2;
|
||||||
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl http2;
|
listen {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl http2;
|
||||||
|
{{ end }}
|
||||||
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
{{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
|
||||||
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
access_log {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
|
||||||
error_log {{ $.NGINX_ERROR_LOG_PATH }};
|
error_log {{ $.NGINX_ERROR_LOG_PATH }};
|
||||||
|
|||||||
Reference in New Issue
Block a user