I am using an AWS Elastic Load Balancer, and have set up the following rule to convert http
traffic to https
.
/etc/httpd/conf.d/httpd_redirect.conf
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
However, when I access my website via its domain (www.thewhozoo.com), I can see the protocol is http
and not https
.
Any ideas why the rewrite rule is not working?
Thanks
More info
/etc/httpd/conf/httpd.conf
...
Include conf.d/*.conf
Include conf.d/elasticbeanstalk/*.conf
...
The above is created on deployment by:
.ebextensions/myapp.config
container_commands:
01_setup_apache:
command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
files:
"/etc/httpd/conf.d/httpd_redirect.conf" :
mode: "000644"
owner: root
group: root
content: |
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
ELB Listeners