A couple of weeks ago we needed to consume from a ReactJS frontend some REST services hosted on some EC2 instances, standing behind an Elastic load balancer.
As you may know, if both the frontend application and the services are not served on the same host (in our case the ReactJS frontend was on a CDN), you need to enable CORS (cross-origin resource sharing) on the server side or you may be blocked by your browser from getting data.
As we are pretty familiar with the load balancers that comes with Elastic Beanstalk deployments, we already knew that this kind of LB didn’t have an option to enable CORS there, so you need to do it in the application itself (by modifying web.config for .net apps, web.xml for java, etc.).
Somehow we were expecting to have a better experience with the stand alone load balancers that you launch from EC2 console, but we found the same absence: we had no option or switch to enable CORS on the load balancer, which would have been great to have.
Instead, we changed the config on every EC2 that were hosting the services to enable CORS. It would be great to have this controlled inside the ELB, so we can enable/disable it for all EC2s behind that ELB.
Apparently, this already have been entered as a feature request on AWS, but we are still anxiously waiting.
Here you can check all about Success Cases of BigCheese, for example a Success Case of Elastic load balancer.
We are BigCheese, an engineering in-house team.