add: handle sending HTTP request to HTTPS port

This commit is contained in:
mcolonna 2025-06-09 16:25:45 +02:00
parent aa2a0d6f71
commit b7cb3733ec
3 changed files with 8 additions and 0 deletions

View file

@ -5,6 +5,7 @@ BUILD_PATH=__build/
DOCKER=docker
SRC_COMPOSE=srcs/
SRC_WWW_MORE=srcs/www/
.ONESHELL :
.SHELLFLAGS = -eu -c
@ -48,6 +49,9 @@ $(WWW_PATH) :
# move in WWW_PATH
rm -rf -- $(WWW_PATH)
mv $(BUILD_PATH)"/www/wordpress" $(WWW_PATH)
echo
echo "also copy files from $(SRC_WWW_MORE)"
cp -r $(SRC_WWW_MORE)/. $(WWW_PATH)
rm -rf $(BUILD_PATH)

View file

@ -30,6 +30,7 @@ http {
ssl_certificate mcolonna.42.fr.crt;
ssl_certificate_key mcolonna.42.fr.key; # TODO(any)(secret) secret? # TODO(any)(nocopy)
ssl_protocols TLSv1.3;
error_page 497 =301 /497.php;
# TODO ssl_ciphers(any)
access_log /var/log/nginx/mcolonna.42.fr.access.log main;

3
srcs/www/497.php Normal file
View file

@ -0,0 +1,3 @@
<?php
http_response_code(301);
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']);