diff --git a/http/Provision/Config/Apache/server.tpl.php b/http/Provision/Config/Apache/server.tpl.php index e6ea28a..6f18f33 100644 --- a/http/Provision/Config/Apache/server.tpl.php +++ b/http/Provision/Config/Apache/server.tpl.php @@ -12,7 +12,6 @@ NameVirtualHost *: - LoadModule env_module modules/mod_env.so @@ -21,6 +20,11 @@ NameVirtualHost *: LoadModule rewrite_module modules/mod_rewrite.so +# Set whether the original request was using HTTPS. + + SetEnv HTTPS on + + ## Size Limits @@ -222,6 +224,14 @@ if ($nginx_has_upload_progress) { ####################################################### ### +### Detect whether the original request was using HTTPS. +### +map $http_x_forwarded_proto $forwarded_protocol { + default "off"; + https "on"; +} + +### ### Support separate Speed Booster caches for various mobile devices. ### map $http_user_agent $device { diff --git a/http/Provision/Config/Nginx/subdir.tpl.php b/http/Provision/Config/Nginx/subdir.tpl.php index 1b1bd8b..ceb6b27 100644 --- a/http/Provision/Config/Nginx/subdir.tpl.php +++ b/http/Provision/Config/Nginx/subdir.tpl.php @@ -318,6 +318,9 @@ location ^~ / { include fastcgi_params; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS $forwarded_protocol if_not_empty; + # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; @@ -812,6 +815,9 @@ location ^~ / { include fastcgi_params; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS $forwarded_protocol if_not_empty; + # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; @@ -1018,6 +1024,9 @@ location ^~ / { include fastcgi_params; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS $forwarded_protocol if_not_empty; + # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; @@ -1099,6 +1108,9 @@ location ^~ / { include fastcgi_params; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS $forwarded_protocol if_not_empty; + # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; @@ -1251,6 +1263,9 @@ location @allowupdate_ { include fastcgi_params; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS $forwarded_protocol if_not_empty; + # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; diff --git a/http/Provision/Config/Nginx/vhost.tpl.php b/http/Provision/Config/Nginx/vhost.tpl.php index 955288e..b3566ac 100644 --- a/http/Provision/Config/Nginx/vhost.tpl.php +++ b/http/Provision/Config/Nginx/vhost.tpl.php @@ -41,6 +41,9 @@ server { # Block https://httpoxy.org/ attacks. fastcgi_param HTTP_PROXY ""; + # Set whether the original request was using HTTPS. + fastcgi_param HTTPS "$forwarded_protocol" if_not_empty; + fastcgi_param MAIN_SITE_NAME uri; ?>; set $main_site_name "uri; ?>"; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;