Skip to content

HTTPS Not Working for Non-WWW Domain on AWS Load Balancer

0

My site is hosted on amazon EC2 instance with load balancer (Not using Route 53 at all)

Certificates covers following domain names: www.example.com - CNAME records are added at domain registrar;

*.example.com and example.com - have the same CNAME, and are added at domain registrar (one CNME record)

Site is reachable when you enter directly in the address line:

www.example.com -this redirects successfully to https://www.example.com and is reachable

example.com - this also redirects successfully to https://www.example.com/ and is reachable

http://example.com/ -this stays as http://example.com/ and goes ok (is reachable)

BUT: when entering directly to address line https://example.com/ (without www) – it is unreachable

Help, where could be the problem?

3 Answers
1

Hello.

What kind of error occurs when accessing with "https://example.com/"?
If "example.com" is included in the certificate, you should be able to access it normally.
Based on your explanation, it doesn't seem to be a problem, so you might want to try clearing your browser's cache and cookies.

*.example.com and example.com - have the same CNAME, and are added at domain registrar (one CNME record)

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Based on the information provided, it appears that the issue is related to the SSL/TLS certificate configuration and DNS settings for your domain. Here are a few potential causes and solutions to consider:

  1. Certificate Configuration: Ensure that your SSL/TLS certificate issued by Amazon Certificate Manager (ACM) correctly includes both "example.com" and "www.example.com" as Subject Alternative Names (SANs). The fact that https://www.example.com works but https://example.com doesn't suggests there might be a mismatch in the certificate configuration.

  2. DNS Configuration: Double-check your DNS settings at your domain registrar. Make sure that both the root domain (example.com) and the www subdomain (www.example.com) have CNAME records pointing to your load balancer's DNS name. It's possible that the CNAME for the root domain is not correctly set up.

  3. Load Balancer Listener: Verify that your load balancer has a listener configured for HTTPS (port 443) that uses the correct SSL/TLS certificate. Ensure that this listener is set up to handle requests for both the www and non-www versions of your domain.

  4. Security Groups: Check that the security group associated with your load balancer allows inbound traffic on port 443 (HTTPS) from all sources (0.0.0.0/0).

  5. Target Group Configuration: Ensure that your target group is correctly configured to forward traffic to your EC2 instance on the appropriate port (usually 80 for HTTP).

  6. EC2 Instance Configuration: Make sure your EC2 instance is properly configured to handle requests coming from the load balancer. This includes having the correct security group rules to allow traffic from the load balancer.

  7. Application Configuration: If your application is handling the redirection from HTTP to HTTPS, ensure that it's configured to handle requests for both www and non-www versions of your domain.

To troubleshoot further, you can try accessing https://example.com directly using a tool like curl with the verbose option to see more details about the connection attempt. This might provide additional clues about where the connection is failing.

If all these settings appear correct, you may want to review your load balancer's access logs or your application logs for any error messages that could provide more insight into the issue.

Sources
Troubleshoot a Classic Load Balancer: Client connectivity - Elastic Load Balancing
How to enable HTTPS for domain name (http working) | AWS re:Post
Not able to access my secure site | AWS re:Post
How do I set up SSL to my ec2 instance via a load balancer? | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Hello, What kind of error occurs when accessing with "https://example.com/"?

"This site can’t be reached The connection was reset. Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_RESET"

So pity, it's still the problem, try clearing cash many times.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.