From 9704b6d21ba966383420eb395701b0e4e8a245e1 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 20 Nov 2017 00:32:40 +0000 Subject: [PATCH] etc/nginx/inc/https-only.conf --- etc/nginx/inc/https-only.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 etc/nginx/inc/https-only.conf diff --git a/etc/nginx/inc/https-only.conf b/etc/nginx/inc/https-only.conf new file mode 100644 index 00000000..9618519d --- /dev/null +++ b/etc/nginx/inc/https-only.conf @@ -0,0 +1,5 @@ +set $redirect 0; +if ( $scheme = http ) { set $redirect 1; } +# Live is behind a load balancer which do only http queries +if ($http_x_forwarded_proto = "https") { set $redirect 0; } +if ( $redirect = 1 ) { return 301 https://$host$request_uri; } -- 2.47.3