From d1a11019e2dd93b2d214e551a5f5d3ef96602600 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Wed, 23 Sep 2026 11:46:23 +0200 Subject: [PATCH] fix: allow running without HTTPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As part of PACKIT-5356 we need to be able to run the container without providing the SSL/TLS itself, as it will be provided by the OpenShift. This should allow us to conditionally let the ‹mod_wsgi-express› handle the SSL/TLS, if there are certificates provided, otherwise just use plain HTTP and let the reverse proxy / OpenShift handle it. Fixes PACKIT-5356 Assisted-by: gpt-5.6-luna medium Signed-off-by: Matej Focko --- files/scripts/run_httpd.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/files/scripts/run_httpd.sh b/files/scripts/run_httpd.sh index 3a0abe59..f83b92cd 100755 --- a/files/scripts/run_httpd.sh +++ b/files/scripts/run_httpd.sh @@ -14,18 +14,29 @@ fi # open HTTP/2 connection gets reused API_SERVER_NAME="${DEPLOYMENT}.packit.dev" +HTTPD_ARGS=( + --access-log + --log-to-terminal + --http2 + --server-name "${SERVER_NAME}" + --server-alias "${API_SERVER_NAME}" + --processes 2 + --locale "C.UTF-8" +) + +if [[ -f /secrets/fullchain.pem && -f /secrets/privkey.pem ]]; then + HTTPD_ARGS+=( + --https-port 8443 + --ssl-certificate-file /secrets/fullchain.pem + --ssl-certificate-key-file /secrets/privkey.pem + ) +else + HTTPD_ARGS+=(--port 8443) +fi + # See "mod_wsgi-express-3 start-server --help" for details on # these options, and the configuration documentation of mod_wsgi: # https://modwsgi.readthedocs.io/en/master/configuration.html exec mod_wsgi-express-3 start-server \ - --access-log \ - --log-to-terminal \ - --http2 \ - --https-port 8443 \ - --ssl-certificate-file /secrets/fullchain.pem \ - --ssl-certificate-key-file /secrets/privkey.pem \ - --server-name ${SERVER_NAME} \ - --server-alias ${API_SERVER_NAME} \ - --processes 2 \ - --locale "C.UTF-8" \ + "${HTTPD_ARGS[@]}" \ /usr/share/packit_dashboard/packit_dashboard.wsgi