I really tried many Solutions to get my site work on Amazon AWS. There is only one last thing i can not solve. Some of my links are still "http://"-links and i dont know how to get them right.
My Setup:
- Drupal 8.6.10 running on an EC2-Instance managed via Beanstalk
- the Load-Balancer is managing the access and has two open ports (http/80 and https/443) directing to the ec2-instance via http (port 80)
- the ssl-certificate is configured
- my domain has the correct dns-config directing to xxx.eu-central-1.elasticbeanstalk.com
- settings.php includes the following lines
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array($_SERVER['PROXY_ADDRESS']);
$settings['reverse_proxy_proto_header'] = 'https';
conf['https'] = TRUE;
$_SERVER['HTTPS']='on';
- $_SERVER['PROXY_ADDRESS'] is assgned to 'xxx.eu-central-1.elasticbeanstalk.com' by beanstalk
- .htaccess includes the following lines:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The affected places are:
- in a twig: url('')
- in a php-file: fileentities->url();
All other links are nicely rendered as 'https'-links. I would be really thankfull for any advice you could give me.
Best Regards,
FirstSanny
https
, this is normally the value. To reduce the affected places use relative urls whenever possible, in Twig path() instead of url().\Drupal::request()->server->all()