I’ve successfully set up HTTPS termination at the AWS Load Balancer, but now I need to secure the connections between the load balancer and my backend servers running Apache on EC2 with a custom SSL certificate. I followed the provided AWS documentation and managed to reach the site, but it keeps throwing 502 gateway errors.
Here’s what I’ve checked so far:
- Security groups are set to allow traffic from the Load Balancer to the Apache servers.
- Network ACLs are configured to allow routing within the VPC (HTTP works well).
- The HTTPS listener for Apache is active (I can access it directly via the EC2 instance).
- I created a PublicKeyPolicyType that links to my certificate’s public key.
- I’ve set up a BackendServerAuthenticationPolicyType that connects to the public key policy.
- This backend authentication policy is utilized with my load balancer.
- The SSL negotiation policy is aligned with the ciphers defined in my Apache setup.
- Apache logs show incoming HTTP requests but not HTTPS requests.
How can I acquire further diagnostic details to resolve this connectivity issue?
Load balancer configuration:
aws elbv2 describe-load-balancers --names my-web-balancer
{
"LoadBalancers": [
{
"LoadBalancerArn": "HIDDEN",
"DNSName": "my-web-balancer.us-east-1.elb.amazonaws.com",
"CanonicalHostedZoneId": "HIDDEN",
"CreatedTime": "2023-05-15T14:22:33.120Z",
"LoadBalancerName": "my-web-balancer",
"Scheme": "internet-facing",
"VpcId": "HIDDEN",
"State": {
"Code": "active"
},
"Type": "application",
"AvailabilityZones": [
{
"ZoneName": "us-east-1a",
"SubnetId": "HIDDEN"
},
{
"ZoneName": "us-east-1b",
"SubnetId": "HIDDEN"
}
],
"SecurityGroups": [
"sg-12345678"
]
}
]
}
Apache configuration for virtual host:
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder on
ProxyPreserveHost On
ProxyPass /api/ http://localhost:9000/
ProxyPassReverse /api/ http://localhost:9000/
</VirtualHost>
Commands to generate certificates:
openssl genrsa -out /etc/ssl/private/server.key 4096
openssl req -new -key /etc/ssl/private/server.key -out /tmp/server.csr
openssl x509 -req -days 730 -in /tmp/server.csr -signkey /etc/ssl/private/server.key -out /etc/ssl/certs/server.crt