From 6dd3d2bb3005aa60dfeb4e7af50e880fc60438dc Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 24 Sep 2019 14:40:21 -0700 Subject: [PATCH] Properly redirect http to https (#1418) Can't use $server_name because it ends up redirecting to 127.0.0.1. Instead, using $host will redirect the site to the appropriate host. --- docker/compose_files/files/nginx.conf.ssl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker/compose_files/files/nginx.conf.ssl b/docker/compose_files/files/nginx.conf.ssl index 8cf867d60..4851df42d 100644 --- a/docker/compose_files/files/nginx.conf.ssl +++ b/docker/compose_files/files/nginx.conf.ssl @@ -70,10 +70,9 @@ http { # Redirects all http traffic to https. server { - listen 80; - server_name 127.0.0.1 localhost; + listen 80; location / { - rewrite ^ https://$server_name$request_uri permanent; + rewrite ^ https://$host$request_uri permanent; } }