I have a django apllication that I deployed on EB. The app only contains my backend endpoint that connect to database. I have encountered a CORS error when connecting to the endpoint from my React app because it only uses http. In order to use https, I tried to use a subdomain for my EB environment.
I followed different tutorials from different articles like configuring load balancer, using Route 53 hosted zone and etc. until I encountered this thread on stackoverflow External subdomain pointing to Elastic Beanstalk environment
I follow the instructions, it said that theres no need to use route 53 and just create a CNAME on my DNS. But when I visited my subdomain, it returns Bad Request (400). When I tried to visit the URL provided by AWS EB, the app is fully working, it only returns error when I am using the subdomain.
Procedures I did. I have domain name outside aws, the main domain serves another app. I set subdomain (e.g.test.domain.com) with the value of my eb environment url from AWS (e.g. test-environment.us-east-2.elasticbeanstalk.com )
curl -i result of the subdomain
HTTP/1.1 400 Bad Request
Date: Thu, 05 Aug 2021 02:40:23 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Server: nginx/1.20.0
Vary: Origin
<!doctype html>
<html lang="en">
<head>
<title>Bad Request (400)</title>
</head>
<body>
<h1>Bad Request (400)</h1><p></p>
</body>
</html>