From 64ae9db37b9eab45bab157a8d10e8822044f445e Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 5 Nov 2016 02:22:49 +0100 Subject: [PATCH] redirect securely by setting HSTS header on both hosts --- sites-available/ssl.example.com | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sites-available/ssl.example.com b/sites-available/ssl.example.com index 5777606..777e4f4 100644 --- a/sites-available/ssl.example.com +++ b/sites-available/ssl.example.com @@ -8,9 +8,8 @@ server { # listen on both hosts server_name example.com www.example.com; - # and redirect to the https host (declared below) - # avoiding http://www -> https://www -> https:// chain. - return 301 https://example.com$request_uri; + # and redirect to the https equivalent (declared below). + return 301 https://$host$request_uri; } server {