Context
Domain set up:
- I have a domain name registered with Porkbun,
my-site.com. - I configured a DNS server with CloudFlare.
- I have an SSL certificate from AWS Certificate Manager for
my-site.com, www.my-site.com, and api.my-site.com. - I placed each CNAME record of the SSL certificate (for my-site.com, www.my-site.com, and api.my-site.com) into my DNS configuration.
With this set-up, my-site.com is trying to send an HTTPS POST request to my Flask application, which is my application's API, hosted on AWS Elastic Beanstalk.
Elastic Beanstalk set up:
I added inbound rules to my EB environment's EC2 security group:
- HTTP requests on port 80 and 0.0.0.0/0
- HTTPS requests on port 443 and 0.0.0.0/0.
I added listeners to the classic load balancer of my EB environment:
- Listener #1) Protocol: HTTP, Port: 80, Instance Protocol: HTTP, Instance Port: 80.
- Listener #2) Protocol: HTTPS, Port: 443, Instance Protocol: HTTP, Instance Port: 80, SSL Certificate: The one I created using ACM.
The environment's URL:
my-site-env.xxx-xxxxxx.us-west-1.elasticbeanstalk.com/.
What I Am Trying To Do
On my-site.com, I am trying to send an HTTPS POST request to my API route: my-site-env.xxx-xxxxxx.us-west-1.elasticbeanstalk.com/api/register
const config = {
headers: {
'Content-Type': 'application/json',
},
};
const body = JSON.stringify({ username, email, password });
const res = await axios.post(
'https://my-site-env.x-xxxxxx.us-west-1.elasticbeanstalk.com/api/register',
body,
config
);
Problem
When my-site.com tries to execute the POST request, I receive this error:
POST https://reddalerts-env.eba-my6f6vhk.us-west-1.elasticbeanstalk.com/api/register
net::ERR_CERT_COMMON_NAME_INVALID
I believe I configured Elastic Beanstalk's incoming traffic rules, as well as listeners to receive an HTTPS request. Am I missing a configuration for my DNS settings?