Force HTTPS with AWS Elastic load balancer

Posted by panos2point0 on Server Fault See other posts from Server Fault or by panos2point0
Published on 2012-11-29T10:40:33Z Indexed on 2012/11/29 11:08 UTC
Read the original article Hit count: 224

I need to redirect all incoming HTTP traffic to HTTPS on my elastic load balancer.

I tired using Apache mod_rewrite:

 RewriteEngine On
 RewriteCond %{HTTP:X-Forwarded-Proto} !https
 RewriteRule !/status https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Taking advantage of the X-Forwarded-Proto header added by the load balancer, this rule should instruct the users browser to request the HTTPS version of the same URL.

So far It doesn't work (no redirection happens).

What am I doing wrong?

Is there a better way to do this?

© Server Fault or respective owner

Related posts about apache2

Related posts about amazon-web-services