Redirect Http to Https Elasticbeanstalk

I need to redirect my website from http to https. I follow aws guide (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-elb.html) and now, if i add "https://" to url, it works. So i add a .config file in .ebextensions folder with this code:

files:
/etc/httpd/conf.d/http-redirect.conf:
mode: "000644"
owner: root
group: root
content: |
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_USER_AGENT} !ELB-HealthChecker
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

It doesn’t work and if i use eb ssh, i don’t see any file in "/etc/httpd/conf.d/"; but if create a .config file like this:

files:
/home/ec2-user/test.conf:
mode: "000755"
owner: root
group: root
content: |
#test

it work and i can see test.conf in /home/ec2-user/ directory

Anyone can hep me?

P.S: I use Apache and symfony

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *