php - Redirection to https not working using AWS Elastic Beanstalk

324

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

359

Answer

Solution:

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

732

Answer

Solution:

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

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

enter image description here

People are also looking for solutions to the problem: php - Is it possible to add a string to the result using mysql?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.