Ad

Redirection To Https Not Working Using AWS Elastic Beanstalk

I have created a environment for my application using AWS Elastic Beanstalk. I have enabled https using the load balancer configuration. I want to redirect traffic from http to https. I have tried all of the following method but it is not working.

1) I created a .ebextensions folder in my project root directory with the file name as https-redirect-php.config.

2)The content of the file was pasted from the following file. https://raw.githubusercontent.com/awsdocs/elastic-beanstalk-samples/master/configuration-files/aws-provided/security-configuration/https-redirect/php/https-redirect-php.config.

3)I created the zip of the folder and deployed it on the server.

4)I also tried using the eb cli command eb deploy but it is not working.

Please suggest me any help. I would be really thankful

Ad

Answer

A solution consists to add to your .ebextensions directory a config file with the following lines :

option_settings:
  aws:elbv2:listener:443:
    ListenerEnabled: 'true'
    Protocol: HTTPS

Take a look at Configuring Your Elastic Beanstalk Environment's Load Balancer to Terminate HTTPS

Ad
source: stackoverflow.com
Ad