diff --git a/src/default.conf b/src/default.conf index 0a9dd11..49eccf9 100644 --- a/src/default.conf +++ b/src/default.conf @@ -13,6 +13,11 @@ server { set_real_ip_from 0.0.0.0/0; # Replace with Traefik's IP range if known real_ip_header X-Forwarded-For; + # Redirect HTTP to HTTPS if forwarded by Traefik + if ($http_x_forwarded_proto = 'https') { + return 301 https://$host$request_uri; + } + # Location block to pass PHP scripts to FastCGI (PHP-FPM) server location ~ \.php$ { try_files $uri =404;