Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
We have an Angular 4 front end hosted on AWS S3 bucket, with an AWS elastic load balancer behind which we have multiple EC2 servers each running a pm2 service behind an nginx proxy.
The REST requests from the front end reaches the server without CORSÂ issues:
- without the AWS elastic load balancer and directly to the EC2Â server
The REST requests breaks with the CORS errors from the front end and not reaches the server:
- with the AWS elastic load balancer and not directly to the EC2Â server
Although weâre not yet successful but these are the stuff (as per @agentspacecake) which we have tried so far:
- Allowed CORS in the S3 bucket, example configâââdone
- Allowed CORS in the back end using CORS node moduleâââdone
- Allowed CORS in the nginx proxy using the CORS headersâââdone
- Allow CORS on the load balancerâs frontââânot done
Based on my studies so far:
- Per @Max@AWS, we need to whitelist the âOriginâ header
- Per @Brian@AWS, weâd want to whitelist the âOriginâ and any other headers youâd like to forward
- This was a bug in the past especially for chrome
- As per @Arun@AWS, the requests needs to contain the headers which are expected to return
- Not sure if the browser caching could surface the CORSÂ issue
- Per @hescar, we can also try adding a âOriginâ header
- Looks like, we shall not use *Â wildcard
- The AWS staff says that ELB doesnât support CORSÂ yet
- The feature request to ELB CORS support still looks open
- The docs says that the JSON Content-Type is not allowed in simple/actual requests
Requests only use the GET or POST HTTP methods. If the POST method is used, then Content-Type can only be one of the following: application/x-www-form-urlencoded, multipart/form-data, or text/plain.
Hope this helps to some extent.
AWS Elastic load balance and CORS issues was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.