Hi I am trying to load balance 2 web application which are based on Angular 7. Each application has set of resources like assets folder, js, css, images to be loaded when we are on the landing page.
I am using following configuration to setup upstream using nginx but somehow its taking IP of the load balancer instead of the actual server IP.
nginx configuration :
upstream backend {
# server 10.1.0.101;
server IP_1;
server IP_2;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
proxy_pass http://backend;
proxy_bind $remote_addr transparent;
}
}
If I visit IP_1 I could see that assets and other resources are loading with https://IP_1/assets/js etc and this is same fo IP_2.
But when I am trying with load balancer ( IP_3 ) its is taking load balancer's IP_3 to load the resources like https://IP_3/assets/js which is not working which is obvious because resources are on individual servers.
I want my load balancer to take target server's IP while loading the IP addresses while loading the resources and doing other HTTP calls from respective server.
Please help me achieve this.