Apache
The rewrite rule for an Apache backend is similar to the following in .htaccess:
The rewrite rule for an Apache backend is similar to the following in .htaccess:
RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
Nginx
The rewrite rule for an Nginx backend in the ngnix.conf file is similar to the following:
Note: Applies to versions nginx/1.10.3 (Ubuntu) and nginx/1.12.1 (Amazon Linux).
The rewrite rule for an Nginx backend in the ngnix.conf file is similar to the following:
Note: Applies to versions nginx/1.10.3 (Ubuntu) and nginx/1.12.1 (Amazon Linux).
server { listen 80; server_name www.example.org; if ($http_x_forwarded_proto = 'http') { return 301 https://$server_name$request_uri$http_x_forwarded_proto; } }