Elastic Beanstalk Auto-Healing: How We Solved Downtime Issues for High-Traffic HTTPS Applications
Meta Description: Discover how Strinosoft optimized AWS Elastic Beanstalk with Apache, Tomcat, L…
At Strinosoft, we recently deployed a full-stack application using React (frontend) and Spring Boot (backend) on AWS, with a custom domain setup. Here's a comprehensive summary of the real-world challenges we faced and how we resolved them to achieve a smooth, production-ready deployment.
Frontend: React.js hosted on AWS S3 + CloudFront
Backend: Spring Boot deployed on AWS Elastic Beanstalk
Source Control & CI/CD: AWS CodeCommit + CodeBuild + CodePipeline
Domain: techdivinity.in
with subdomains like https://www.techdivinity.in
and https://api.techdivinity.in
Problem: Frontend requests (hosted on CloudFront) were blocked by CORS when calling the Spring Boot backend on a different subdomain (api.techdivinity.in
).
Error Message:
pgsql
CopyEdit
Access to XMLHttpRequest at 'https://api.techdivinity.in/api/iqac-committee' from origin 'https://www.techdivinity.in' has been blocked by CORS policy.
Solution:
Configured CORS headers in WebConfig.java
in Spring Boot using CorsRegistry
.
Added .ebextensions/cors.config
in Elastic Beanstalk to ensure NGINX passes the correct headers.
Ensured https
was used consistently to avoid mixed content issues.
Problem: Despite not using Spring Security, including spring-boot-starter-security
in the pom.xml
enabled default security, which blocked requests.
Solution:
Removed the following dependency from pom.xml
:
xml
CopyEdit
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Cleaned the project and redeployed.
Problem: Backend API returned 302
redirect loops or failed silently.
Solution:
Ensured the Spring Boot app was deployed with the correct port and context path.
Verified that .ebextensions
was structured correctly and deployed with the application .jar
.
Problem: Requests were being made to http://api.techdivinity.in
from a secure https
frontend, triggering browser security blocks.
Solution:
Ensured all Axios calls used https://api.techdivinity.in
.
Checked baseUrl
configurations in all service files.
Problem: Using axios.get("/api/iqac-committee")
worked locally (due to proxy), but failed in production.
Solution:
Replaced relative paths with absolute URLs pointing to the correct subdomain:
js
CopyEdit
const committeeUrl = "https://api.techdivinity.in/api/iqac-committee";
After these refinements, our frontend and backend communicate seamlessly across subdomains using HTTPS. The full CI/CD pipeline with CodeCommit → CodeBuild → CodePipeline ensures zero-downtime deployments and easy scalability.
Setting up production-ready full-stack apps with AWS can be complex, especially around domain routing, CORS, and deployment automation. However, with the right architecture and configuration tweaks, it’s completely achievable.
Tech used:
React, Spring Boot, Maven
AWS S3, CloudFront, Elastic Beanstalk, CodePipeline
Route 53 for DNS management
Written by the Strinosoft DevOps & Full-Stack Team
Need help deploying your app the right way? Contact us at strinosoft.com ????