0

I have setup application load balancer in AWS. I have setup target and listeners correctly. Load balancer is configured to handle Https request and SSL certificate is also configured correctly from ACM.

All request over http and https from POSTMAN and Web browser are returning response correctly. It gives response correctly.

However when i am trying to make https request from Angular 6 app, it fails with following error:

net::ERR_CONNECTION_CLOSED

All HTTP requests are successful.

Many posts said to set Access-Control-Allow-Origin headers and its correctly set in my server api code.

Is there anything am I missing?

4

1 回答 1

0

你必须在你的 AWS 服务中配置你的 CORS 配置,看看; https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html

由于 Angular 是一个客户端应用程序,因此您总是需要处理这个问题。

我建议您详细了解这将如何保护您免受黑客等攻击。但如果您只测试并想要访问您的 AWS,您可以允许给定 HTTP 请求的所有标头。

   <AllowedMethod>PUT</AllowedMethod>
   <AllowedMethod>POST</AllowedMethod>
   <AllowedMethod>DELETE</AllowedMethod>
   <AllowedHeader>*</AllowedHeader>

阅读更多关于一般 CORS 的信息; https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

于 2018-11-22T07:49:08.230 回答