0

I have install magento2 in AWS ec2 behind a load balancer . But when i try to access to login admin page i have error too many redirection

The problem is all solution i have fine not work .

I try all of this

php bin/magento config:set web/secure/use_in_adminhtml 1
php bin/magento config:set web/secure/use_in_frontend 1
php bin/magento config:set web/cookie/cookie_httponly 0

i try to put web/unsecure/base_url with a https

web/unsecure/base_url = https://example.com

i try too remove and add my domain name in this variable

web/cookie/cookie_domain NULL
web/cookie/cookie_domain https://example.com

i try to put this in my .htaccess

SetEnv X-Forwarded-Proto=https
SetEnv HTTPS=on

or

SetEnvIf X-Forwarded-Proto https HTTPS=on

i try too add on the index.php

$_SERVER['HTTPS']='on';

but i don't have mage::run

my index.php finish with this

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);

my core_config_data look like this

0,web/cookie/cookie_httponly,0
0,web/secure/base_link_url,https://example.com
0,web/secure/base_url,https://example.com
0,web/secure/use_in_adminhtml,1
0,web/secure/use_in_frontend,1
0,web/seo/use_rewrites,1
0,web/unsecure/base_url,http://example.com

2 Answers 2

0

Before using setEnv for SSL variables, you must first initialize them using SLOptions StdEnvVars.

After that you can define the variables referring to ssl:

<IfModule mod_ssl.c>
  SSLOptions StdEnvVars
  SetEnv X-Forwarded-Proto "https"
  SetEnv HTTPS "on"
</IfModule>
0

I have found an answer that may solve your issue: https://magento.stackexchange.com/a/38251

Add these lines to the end of your .htaccess and it should be fine:

Detect the Load-Balancer-Header and set the header magento expects

SetEnvIf X-Forwarded-Proto https HTTPS=on

Could you try it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.