If you want traffic coming to web server redirect to https without change the backed listener to port 443,
ELB supports a HTTP header called X-FORWARDED-PROTO. you can force the http to https redirection by writing simple rule.
If your using IIS,
If your using NGINX,
ELB supports a HTTP header called X-FORWARDED-PROTO. you can force the http to https redirection by writing simple rule.
If your using IIS,
<rewrite xdt:Transform="Insert"> <rules> <rule name="HTTPS rewrite behind ELB rule" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" /> </rule> </rules> </rewrite>If your using Apache,
<VirtualHost *:80> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NE] </VirtualHost>
If your using NGINX,
server { listen 80; location / { if ($http_x_forwarded_proto != 'https') { return 301 https://$server_name$request_uri; } try_files $uri $uri/ /index.php?$args; } }
0 coment�rios:
Post a Comment