diff --git a/Nginx/default.conf.template b/Nginx/default.conf.template index 189b3f6d7e..1e8b01faba 100644 --- a/Nginx/default.conf.template +++ b/Nginx/default.conf.template @@ -127,21 +127,34 @@ server { location / { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + if ($billing_enabled = true) { + return 301 https://$host$request_uri; + } - proxy_pass http://status-page; + if ($billing_enabled != true) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_pass http://status-page; + } + } location /status-page { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + if ($billing_enabled = true) { + return 301 https://$host$request_uri; + } - proxy_pass http://status-page; + if ($billing_enabled != true) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_pass http://status-page; + } } location /status-page-api/ {