1
votes

We are using web app(angular) and api(node.js) running on nginx. I need to use the AWS Load balancer , domain name (route 53), SSL Certificate (ACM).

I have obtained the SSL from ACM. I have created the elastic load balancer and attached the ssl certificate. I have assigned the web servers to the AWS load balancer. I have created the domain name in route 53 and pointed to the load balancer. I have updated the nginx configuration file and added the domain name to the server name

I am able to access the webservers from the https://example.com but the webservers are not connecting to the api servers. I am getting error "Failed to connect" when i try to login the web app
I believe that the api server should also have the ssl certificate attached.
Currently, I do not have the API server in the load balancer.

How can i configure the web app servers and api servers with the ssl certificate using the AWS load balancer?

How do I add ssl certificate to the api server? do i need to create an internal load balancer and add the ssl certificate. if yes, how do i use the internal load balancer with the web server load balancer?

What would be the architecture for the same?

Without the load balancer, I was able to connect to web app and api using the godaddy ssl and domain for web and api.

However, I am not able to use the aws load balancer and aws certificate manager

Nginx config

Web server

server 
{
 listen 80;
 server_name example.com;
 return 301 https://example.com$request_uri;
 root /Website/dist/;
 index index.html;
}

API server

server 
{
 listen 80 ;
 server_name ipaddress_api;
location / 
  proxy_pass http://localhost:7000;
}
1
Now i created 1 AWS load balancer for webserver app and the other AWS Load balancer for API server. I also attached the acm certificate to the web server load balancer and other acm certificate to api loadbalancer. Now, when i have 2 or more web servers in the load balancer , it gives error " Failed to load resource: the server responded with a status of 404 ()". "Uncaught ReferenceError: webpackJsonp is not defined at main.bundle.js:1". "DevTools failed to parse SourceMap:". But If i have only 1 webserver in the AWS load balancer, then everything seems to work fine. - Rajspeeder

1 Answers

1
votes

One solution will be to access the Back-end apis using Load Balancer. You can differentiate front end and back end requests by appending "/api" in front of all back end requests. You will have to use separate "location" block in the nginx conf file.