I've deployed a React application on an AWS EC2 instance using Nginx. The application is accessible via the EC2 public IP and works as expected.
I also set up a custom domain e.g: (example.work.gd) from freedomain.one, generated SSL certificates using Certbot, and was able to access the application through the domain earlier.
However, after making code changes and reloading Nginx, I started facing SSL-related errors when accessing the app through the domain:
Secure Connection Failed
SSL received a record that exceeded the maximum permissible length
Certificate is invalid
In some cases, it even redirects to dnsexit.com, which shouldn’t happen. The domain previously worked fine and pointed correctly to the EC2 instance.
I expected (example.work.gd) to resolve to my React app hosted on the EC2 instance and load over HTTPS without issues.
Here’s what I’ve verified so far: DNS Configuration
A record: example.work.gd → EC2 public IP
CNAME: www.exmaple.work.gd → EC2 hostname (ec2-...compute.amazonaws.com)
DNS propagation is complete (verified using dig and online tools)
Nginx Configuration
server_name and listen 443 ssl blocks are correctly set
React app is served from /var/www/html
index.html is rendered properly when using the public IP
Certbot
Certificates are valid for both example.work.gd and www.example.work.gd
Correct cert paths are configured in Nginx
GitHub Actions
CI/CD pipeline builds and uploads the React app via SCP & SSH
Files are deployed to /var/www/html, and changes are reflected successfully
Nginx is reloaded as part of the deployment process