简体   繁体   中英

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

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

Go to ELASTIC BEANSTALK -> CONFIGURATION -> LOAD BALANCER -> RULES

After you have your ports and your Certificate try to add this rules:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM